Error: -
192.168.43.216 | FAILED! => {
"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
}
If you get above error message on Ansible controller that means your managed host are not added to known hosts. You can fix this issue in two way: -
1. Add "host_key_checking = false" in ansible.cfg(best practice)
[root@ansible ssh]# cat >> /etc/ansible/ansible.cfg
host_key_checking = false
Let's check if issue has been fixed, If I am getting "ping": "pong" response that mean the issue has been fixed.
[root@ansible ssh]# ansible all -m ping
192.168.43.72 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
192.168.43.216 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
2. Initiate ssh connection and Accept ssh fingerprint: - As we know by default Ansible need ssh connection between controller node and managed node and when first time someone try to ssh any host, we have accept connection fingerprint just for very first time only.
[root@ansible ~]# ssh 192.168.43.216
The authenticity of host '192.168.43.216 (192.168.43.216)' can't be established.
ECDSA key fingerprint is SHA256:Os7z03gBEm2OZz1Cjy/yQ5j+Eyrj4FMlnQxlvDoe7Lk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
root@192.168.43.216's password: ***********
[root@managed-node2 ~]#
That's how you can fix this issue.
Comments
Post a Comment
Please share your experience.....