问题描述:
[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]
原因:
当ansible首次去进行ssh连接一个服务器的时候,由于在本机的~/.ssh/known_hosts文件中并有fingerprint key串,ssh第一次连接的时候一般会提示输入yes 进行确认为将key字符串加入到 ~/.ssh/known_hosts 文件中。故回报如上错误。
解决办法:在/etc/ansible/ansible.cfg文件中进行配置;
在# uncomment this to disable SSH key host checking下
host_key_checking = False默认是注释掉的
打开 host_key_checking = False的注释。同样也可以实现跳过 ssh 首次连接提示验证部分。