# Ansible ping issue

**URL:** <https://forum.ansible.com/t/ansible-ping-issue/25506>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 18, 2017, 6:33am UTC](https://forum.ansible.com/t/ansible-ping-issue/25506 "2017-09-18T06:33:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sreekuttan\_Sree](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Sreekuttan\_Sree](https://forum.ansible.com/u/Sreekuttan_Sree)\
**Post date:** [September 18, 2017, 6:33am UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/1 "2017-09-18T06:33:30Z")

</div>

Hi Team,

Am new to ansible. when am pinging to node machine it shows error like this.  
META: ran handlers  
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py  
\<192.168.80.129\> ESTABLISH SSH CONNECTION FOR USER: ubuntu  
\<192.168.80.129\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/827e4da918 192.168.80.129 ‘/bin/sh -c ‘"’“‘echo ~ && sleep 0’”’"‘’  
\<192.168.80.129\> (255, ‘’, ‘Permission denied (publickey,password).\r\n’)  
192.168.80.129 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n”,  
“unreachable”: true

---

<div class="post-metadata">

**Author:** ![Goetz\_Leupold](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Goetz\_Leupold](https://forum.ansible.com/u/Goetz_Leupold)\
**Post date:** [September 18, 2017, 7:45am UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/2 "2017-09-18T07:45:53Z")

</div>

The problem is, that Ansible could not connect to the remote host:  
Permission denied (publickey,password).  
You must add your public key to the ~/.ssh/authorized\_keys file of the corresponding user(ansible user) on the remote host where you want to do the ping.

---

<div class="post-metadata">

**Author:** ![Sreekuttan\_Sree](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Sreekuttan\_Sree](https://forum.ansible.com/u/Sreekuttan_Sree)\
**Post date:** [September 18, 2017, 8:17am UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/3 "2017-09-18T08:17:00Z")

</div>

Hi sir,  
Thank you so much…i got the idea.thank you. Am new in ansible and linux so that am facing lot of issue.Thanks for help.

Thanks and Regards  
sreenath v

---

<div class="post-metadata">

**Author:** ![manoj4digitamize](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@manoj4digitamize](https://forum.ansible.com/u/manoj4digitamize)\
**Post date:** [September 20, 2017, 1:25pm UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/4 "2017-09-20T13:25:13Z")

</div>

Hi I am also getting the same error, I also had publickey of another system in .ssh/authorized\_keys please help me in this issue

---

<div class="post-metadata">

**Author:** ![Sreekuttan\_Sree](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Sreekuttan\_Sree](https://forum.ansible.com/u/Sreekuttan_Sree)\
**Post date:** [September 20, 2017, 1:29pm UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/5 "2017-09-20T13:29:24Z")

</div>

Hi,  
run the command in control machine and node machine.

ssh-keygen

the u will generate ssh key

then  
ssh-copy-id node machine ipaddress

then check

sudo ansible -m ping all

hope it will work…it works for me.you need to genearte ssh key in both machine.

Thank you

---

<div class="post-metadata">

**Author:** ![manoj4digitamize](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@manoj4digitamize](https://forum.ansible.com/u/manoj4digitamize)\
**Post date:** [September 20, 2017, 1:40pm UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/6 "2017-09-20T13:40:37Z")

</div>

Hi, I generated ssh key I copied ssh key of mine and my friends system in authorized\_keys

Now in  
etc/ansible/hosts file I mentioned server and gave host of my friend.

like this

[prasad]  
192.168.1.12

# This is the default ansible ‘hosts’ file.

---

<div class="post-metadata">

**Author:** ![manoj4digitamize](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@manoj4digitamize](https://forum.ansible.com/u/manoj4digitamize)\
**Post date:** [September 20, 2017, 1:41pm UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/7 "2017-09-20T13:41:03Z")

</div>

I am very new to the both linux and ansible

---

<div class="post-metadata">

**Author:** ![Sreekuttan\_Sree](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Sreekuttan\_Sree](https://forum.ansible.com/u/Sreekuttan_Sree)\
**Post date:** [September 20, 2017, 1:47pm UTC](https://forum.ansible.com/t/ansible-ping-issue/25506/8 "2017-09-20T13:47:30Z")

</div>

Hi manoj,

ya its oke…just ping  
ssh

and check wheatr ssh is working

then type  
ssh-keygen(in urs and friends)  
thn it will ask for a passphrase and all…give it.

then type

ssh-copy-id \< node ipadress\>

it will show a message that key added =1

then type command

sudo ansible -m ping all
