Error when trying to ping nodes through Ansible

My project is to set up a sensor network of several nodes. I want to use Ansible to configure all nodes through ssh, so I downloaded ansible with pip and generated a ssh keypair. I then copied the key from the master to the node I am testing on. I also edited the host file with:

[node]

pi@###.###.###.###

I know I can access the node through ssh, because I did a ssh pi@###.###.###.### and got connection. I also tried to ping the ip and it worked like it should. Now, when I try to ping with ansible (ansible all -m ping) it won’t work. I get the id_rsa password prompt, but after that I get this error message:

pi@###.###.###.### | UNREACHABLE! => {
“changed”: false,
“msg”: “SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh”,
“unreachable”: true
}

Since I know the host can be reached over ssh I really don’t know how to get around this hurdle. Does anyone know what’s wrong?

All help would be much appriciated!

One last thing:) if i run ansible -vvvv i get at the end of the output:

ERROR! Missing target hosts

Your inventory file(that you call host file) is wrong.
I suggest you read this
https://docs.ansible.com/ansible/intro_inventory.html

Did you even look at the page Kai sent the link to?

You can write something like

[nodes]
192.168.137.146 ansible_user=pi

but "pi@192.168.137.146" is senseless.

HTH,
Werner

Jørgen Høyer [13.07.2016 11:29]:

Sorry, I took a look at it. Just didn’t get it, i’m very new to this…Thank you for responding^^

onsdag 13. juli 2016 11.35.06 UTC+2 skrev Werner Flamme følgende:

Thank you so much, that worked! What’s that atachment?

onsdag 13. juli 2016 11.35.06 UTC+2 skrev Werner Flamme følgende:

Ah, just an secure e-mail. Ok.

onsdag 13. juli 2016 11.35.06 UTC+2 skrev Werner Flamme følgende: