# Error when trying to ping nodes through Ansible

**URL:** <https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003>\
**Category:** Ansible Project\
**Created:** [July 13, 2016, 8:52am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003 "2016-07-13T08:52:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorgen\_Hoyer](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jorgen\_Hoyer](https://forum.ansible.com/u/Jorgen_Hoyer)\
**Post date:** [July 13, 2016, 8:52am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/1 "2016-07-13T08:52:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Jorgen\_Hoyer](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jorgen\_Hoyer](https://forum.ansible.com/u/Jorgen_Hoyer)\
**Post date:** [July 13, 2016, 8:59am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/2 "2016-07-13T08:59:47Z")

</div>

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

ERROR! Missing target hosts

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 13, 2016, 9:10am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/3 "2016-07-13T09:10:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Werner\_Flamme](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@Werner\_Flamme](https://forum.ansible.com/u/Werner_Flamme)\
**Post date:** [July 13, 2016, 9:34am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/4 "2016-07-13T09:34:53Z")

</div>

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]:

---

<div class="post-metadata">

**Author:** ![Jorgen\_Hoyer](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jorgen\_Hoyer](https://forum.ansible.com/u/Jorgen_Hoyer)\
**Post date:** [July 13, 2016, 9:38am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/5 "2016-07-13T09:38:50Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![Jorgen\_Hoyer](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jorgen\_Hoyer](https://forum.ansible.com/u/Jorgen_Hoyer)\
**Post date:** [July 13, 2016, 9:44am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/6 "2016-07-13T09:44:28Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Jorgen\_Hoyer](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jorgen\_Hoyer](https://forum.ansible.com/u/Jorgen_Hoyer)\
**Post date:** [July 13, 2016, 9:46am UTC](https://forum.ansible.com/t/error-when-trying-to-ping-nodes-through-ansible/22003/7 "2016-07-13T09:46:39Z")

</div>

Ah, just an secure e-mail. Ok.

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