Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

Inventory example usage fails #19

Open
patricks opened this issue May 30, 2018 · 2 comments
Open

Inventory example usage fails #19

patricks opened this issue May 30, 2018 · 2 comments

Comments

@patricks
Copy link

Hi,

I tried to run your example:

ansible -i hcloud_inventory all -m ping

But I get the following output:

[WARNING]: Unable to parse /Users/foobar/hcloud_inventory as an inventory
source

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match 'all'

I have copied the hcloud_inventory binary into ~/.ansible/plugins/modules/ on my macOS machine.

Any ideas what's wrong?

@thetechnick
Copy link
Owner

Hi @patricks,
the inventory is not installed as a module but referenced directly with -i path/to/the/hcloud_inventory.
Make sure to have the HCLOUD_TOKEN environment variable set to the project token you want to use.

I will add documentation how to use the inventory with the next update.

@exquisitus
Copy link

Hello @thetechnick,

Thank you for your work on hcloud-ansible. I would like to ask this

export HCLOUD_TOKEN=7zt.....
ansible -i ~/.ansible/plugins/modules/hcloud_inventory all -m ping

Ansible finds that there is only one server in the all group (my-server) but cannot connect

my-server | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '159.69.22.126' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,password).\r\n",
    "unreachable": true
}

If I add an entry with the IP and IdentityFile for my-server to my .ssh/config, then the same succeeds

my-server | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Is this manual step necessary? I ask because
hcloud server ssh my-server connects to my-server without it (it only needs my API token).

(it might be that I am missing something very basic, sorry if that is the case)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants