Ansible: Permission denied (publickey, password)

Question:

I’m not able to connect to a host in Ansible. This is the error:

192.168.1.12 | UNREACHABLE! => {
“changed”: false,
“msg”: “ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which
will enable SSH debugging output to help diagnose the issue”,
“unreachable”: true }

This is my hosts file:

And this is the ad-hoc instruction:

I’m able to connect via raw ssh.

Answer:

By default Ansible try to use SSH keys. It seems that you have wrong keys. Try to use Password authentication.

ansible all -m ping --ask-pass --ask-sudo-pass

I Hope it helps.

Leave a Reply