使用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

posted @ 2022-08-02 10:13  paul_hch  阅读(4557)  评论(0编辑  收藏  举报