Ansible ping issue

1,198 views
Skip to first unread message

Sreekuttan Sree

unread,
Sep 18, 2017, 2:33:30 AM9/18/17
to Ansible Project

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

Goetz Leupold

unread,
Sep 18, 2017, 3:45:53 AM9/18/17
to Ansible Project
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.

Sreekuttan Sree

unread,
Sep 18, 2017, 4:17:12 AM9/18/17
to ansible...@googlegroups.com
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

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/w27Iqn74RcM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3c2e3fb0-d09d-4957-8d67-4b501263f3f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

manoj4di...@gmail.com

unread,
Sep 20, 2017, 9:25:13 AM9/20/17
to Ansible Project
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
 

Sreekuttan Sree

unread,
Sep 20, 2017, 9:29:39 AM9/20/17
to ansible...@googlegroups.com
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



--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/w27Iqn74RcM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Manoj Manchukonda

unread,
Sep 20, 2017, 9:40:57 AM9/20/17
to ansible...@googlegroups.com
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.
#
# It should live in /etc/ansible/hosts
#
#   - Comments begin with the '#' character
#   - Blank lines are ignored
#   - Groups of hosts are delimited by [header] elements
#   - You can enter hostnames or ip addresses
#   - A hostname/ip can be a member of multiple groups


and I tried 


sudo ansible -m ping all

I got this error

192.168.1.12 | UNREACHABLE! => {

Manoj Manchukonda

unread,
Sep 20, 2017, 9:41:21 AM9/20/17
to ansible...@googlegroups.com
I am very new to the both linux and ansible

On Wed, Sep 20, 2017 at 6:59 PM, Sreekuttan Sree <sreekutta...@gmail.com> wrote:

Sreekuttan Sree

unread,
Sep 20, 2017, 9:47:47 AM9/20/17
to ansible...@googlegroups.com
Hi manoj,

ya its oke..just ping 
ssh  <ipadress>

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
Reply all
Reply to author
Forward
0 new messages