Using a SSH password instead of a key is not possible because Host Key checking
Using a SSH password instead of a key is not possible because Host Key checking
运维
专栏收录该内容
12 篇文章
0 订阅
运行ansible出错
[root@ansible ~]# ansible webservers -m ping -u root -k
SSH password:
192.168.154.130 | FAILED! => {undefined
"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."
}
解决方法:
vi /etc/ansible/ansible.cfg
在文件中进行搜索定位到
:/host_key_checking
# uncomment this to disable SSH key host checking
#host_key_checking = False
修改后:
# uncomment this to disable SSH key host checking
host_key_checking = False
试一下:
[root@ansible ~]# ansible webservers -m ping -u root -k
SSH password:
192.168.154.130 | SUCCESS => {undefined
"changed": false,
"ping": "pong"
}