报错信息:
[root@localhost ansible]# ansible -i /etc/ansible/hosts web-servers -m ping
"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."
解决办法:
1、如果主机和被控制端第一次通讯,需要先添加指纹信息
ping 192.168.75.129
[root@localhost ansible]# ping 192.128.75.129
PING 192.128.75.129 (192.128.75.129) 56(84) bytes of data.
--- 192.128.75.129 ping statistics ---
94 packets transmitted, 0 received, 100% packet loss, time 93033ms
[root@localhost ansible]# ansible -i /etc/ansible/hosts web-servers -m ping
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.75.129 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
2、如果多台机器第一次的情况下,可以开启ansible中的 host_key_checking = False
[root@localhost ansible ~]# vim /etc/ansible/ansible.cfg
host_key_checking = False
858

被折叠的 条评论
为什么被折叠?



