Problem Description:
[root@iZm5e79rtwsq2hm57teyk5Z ansible]# ansible aofeng -f 5 -m ping 47.93.18.191 | FAILED! => { "failed": true, "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." } [root@iZm5e79rtwsq2hm57teyk5Z ansible]
reason:
When Ansible goes to ssh to connect to a server for the first time, because there is a fingerprint key string in the ~/.ssh/known_hosts file of the local machine, when ssh connects for the first time, it will generally prompt to enter yes for confirmation as the key string Add to ~/.ssh/known_hosts file. So the above error is reported.
Solution: configure in the /etc/ansible/ansible.cfg file;
在# uncomment this to disable SSH key host checking下
host_key_checking=False is commented out by default to
open the comment for host_key_checking=False. It is also possible to skip the verification part of the ssh first connection prompt.