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
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.
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
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
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
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.
I am very new to the both linux and ansible
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