ansible执行playbook报Host Key checking
报错信息:
(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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南