贴上报错:
[root@ansible ~]# ansible -i /etc/ansible/hosts web -m ping
192.168.0.203 | 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."
}
后来找啊找啊终于找到问题所在:
root@ansible ~]# vim /etc/ansible/ansible.cfg
在文件中进行搜索定位到
:/host_key_checking
#host_key_checking = False
修改后:
host_key_checking = False
(就是去掉注释保存)
然后:
[root@ansible ~]# ansible -i /etc/ansible/hosts web -m ping
192.168.0.203 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}