# Cant ping nodes via ssh

**URL:** <https://forum.ansible.com/t/cant-ping-nodes-via-ssh/21994>\
**Category:** Ansible Project\
**Created:** [July 12, 2016, 2:59pm UTC](https://forum.ansible.com/t/cant-ping-nodes-via-ssh/21994 "2016-07-12T14:59:45Z")\
**Posts on this page:** 3\
**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 12, 2016, 2:59pm UTC](https://forum.ansible.com/t/cant-ping-nodes-via-ssh/21994/1 "2016-07-12T14:59:45Z")

</div>

I’m trying to set upp ansible for a project with multiple Raspberry Pi’s. I created sshkey’s and copied them to my test node. I also made a host list. When i try to ping (ansible all -m ping) the node i keep getting the same errormsg:

SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh.

I know I can connect via ssh, because I did a test with ssh pi@ip\_address. I also have to enter passphrase for id\_rsa so i guess that means it recognizes the key on both ends?

When I run -vvvv it says:  
ERROR! Missing target hosts

Anyway. If anybody came across this error before or know how I can solve it I would be greatfull.

---

<div class="post-metadata">

**Author:** ![Butor32](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@Butor32](https://forum.ansible.com/u/Butor32)\
**Post date:** [July 14, 2016, 9:42am UTC](https://forum.ansible.com/t/cant-ping-nodes-via-ssh/21994/2 "2016-07-14T09:42:18Z")

</div>

- First you must have a host file list, with the name of your differents raspberry:  
[server]  
raspberry1  
raspberry2
- Save into hosts file name  
ansible-playbook -i hosts -l server (your ansible script)

(your ansible script)

- hosts: all  
remote\_user: root  
gather\_facts: yes  
tasks:
- ping:

---

<div class="post-metadata">

**Author:** ![Simon\_Beaulieu](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@Simon\_Beaulieu](https://forum.ansible.com/u/Simon_Beaulieu)\
**Post date:** [July 14, 2016, 7:29pm UTC](https://forum.ansible.com/t/cant-ping-nodes-via-ssh/21994/3 "2016-07-14T19:29:48Z")

</div>

Hi Jørgen,

By default, ansible uses the default host file specified @ /etc/hosts (I’m assuming you are using linux here). If you specified a separate host file, you need to tell ansible its location with the **-i** option.  
Also, do you think you can share the content of your host file ? It has to be something like this : (the IP adress is fictive and for demonstration purposes only)

[group\_name]  
custom\_hostname ansible\_host=192.168.1.2

Or

[group\_name]  
192.168.1.2
