hcloud-ansible
hcloud-ansible copied to clipboard
Inventory example usage fails
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?
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.
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)