报错信息:
(fastapi-ansible) root@WEB:/data/fastapi-ansible/project# ansible-playbook -i hosts ping.yaml PLAY [Ping Test Playbook] ********************************************************************************************************************* TASK [Ping 检测] ****************************************************************************************************************************** fatal: [10.11.16.8]: 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."} PLAY RECAP ************************************************************************************************************************************ 10.11.16.8 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
解决办法:
方式1、在hosts文件中用ssh秘钥
[user] 10.11.16.8 ansible_ssh_user=root ansible_ssh_port=32069 ansible_ssh_private_key_file=/root/.ssh/id_rsa
方式2、修改ansible配置文件,禁用ssh秘钥主机检查
vim /etc/ansible/ansible.cfg
# uncomment this to disable SSH key host checking host_key_checking = False
标签:checking,host,Host,ansible,ssh,key,playbook From: https://www.cnblogs.com/zhangzhide/p/18541808