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

喝粥也会胖的唐僧 于 2019-04-26 12:46:27 发布 13278 收藏 8
分类专栏: 运维
运维 专栏收录该内容
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"
}
 


yg9538 2022年7月22日 22:48 237 收藏文档