Ansible - Resolve "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this"

by
Jeremy Canfield |
Updated: March 10 2023
| Ansible articles
Let's say something like this is being returned.
fatal: [server1.example.com]: 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."}
Check out my article on Getting Started with SSH.
Known hosts
When making an SSH connection to a managed node, if the public certificate of the managed node (server1 in this example) is not listed in the /etc/ssh/ssh_known_hosts or /home/username/.ssh/known_hosts file on the control node, a prompt will appear stating The authenticity of host 'hostname (ip address)' can't be established, like this.
The authenticity of host 'server1 (10.115.55.189)' can't be established
DSA key fingerprint is BB37 83F2 5E3A 7A4C 6C84 F047 D97B DD4E 38BB 2082
Are you sure you want to continue connecting (yes/no)?
Typing yes and pressing enter will append the key of the managed node to the known hosts file on the control node. Or, the known_hosts module can be used to append the managed nodes key to your known hosts file.
Did you find this article helpful?
If so, consider buying me a coffee over at