使用ansible时报错显示Failed to connect to the host via ssh【转】
fatal: [192.168.0.2]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\r\nIt is also possible that a host key has just been changed.\r\nThe fingerprint for the ECDSA key sent by the remote host is\n7d:90:8f:e0:c4:6c:b7:31:74:32:96:4a:bd:f4:45:71.\r\nPlease contact your system administrator.\r\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\r\nOffending RSA key in /root/.ssh/known_hosts:378\r\nECDSA host key for 192.168.0.2 has changed and you have requested strict checking.\r\nHost key verification failed.\r\n”, “unreachable”: true}
vim ~/.ssh/known_hosts
删除192.168.0.2的相关rsa的信息即可.
报错2:Connection refused\r\nConnection timed out during banner exchange
10.x.x.x | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Control socket connect(/root/.ansible/cp/b53f4d8e61): Connection refused\r\nConnection timed out during banner exchange", "unreachable": true }
或
172.20.1.1 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Control socket connect(/home/hadoop/.ansible/ansible_control_path/55a69c5722): Connection refused\r\nFailed to connect to new control master", "unreachable": true }
解决办法:
登录目标服务器10.x.x.x的修改
# ll -thr total 8.0K -rw------- 1 root root 2.4K Sep 29 2020 authorized_keys -rw-r--r-- 1 root root 786 Oct 11 2021 known_hosts vi authorized_keys 删除ansible服务器的内容
转自
(39条消息) 使用ansible时显示Failed to connect to the host via ssh_sdd220的博客-CSDN博客
https://blog.csdn.net/sdd220/article/details/78560346
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2017-08-02 离线部署ELK+kafka日志管理系统【转】
2017-08-02 Elasticsearch5.0 安装问题集锦【转】