gpt4 book ai didi

linux - 无法通过 Ansible ping 我的远程计算机

转载 作者:太空宇宙 更新时间:2023-11-04 05:21:38 25 4
gpt4 key购买 nike

我正在尝试使用以下命令ping我的远程Linux计算机:

ansible remote -m ping -vvvv

我收到以下回复:

[root@ansible ansible]# ansible remote -m ping -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback minimal of type stdout, v2.0
<192.41.50.9> ESTABLISH SSH CONNECTION FOR USER: root
<192.41.50.9> SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 192.41.50.9 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1480431200.39-212981181831507 `" && echo ansible-tmp-1480431200.39-212981181831507="` echo $HOME/.ansible/tmp/ansible-tmp-1480431200.39-212981181831507 `" ) && sleep 0'"'"''
192.41.50.9 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh.",
"unreachable": true
}

我的主机文件如下所示:

[remote]
192.41.50.9

[remote:vars]
ansible_ssh_user=root
ansible_ssh_pass=p@ssw0rd
ansible_ssh_port=22

当我尝试 ssh 进入我的远程计算机时,这就是我得到的:

[root@ansible ansible]# ssh root@192.41.50.9
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
86:d2:ca:8e:aa:8a:ce:25:c7:e5:31:7e:2a:c0:11:7f.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:3
RSA host key for 192.41.50.9 has changed and you have requested strict checking.
Host key verification failed.

导致连接失败的原因可能是什么?

最佳答案

如果你阅读 shell ssh 的输出,你会发现

  1. 您正在遭受中间人攻击(可能性很小)
  2. 服务器上的 ssh key 已更改(因为您重新创建了它并保留了相同的 IP)。

如果您的情况是后一种情况,您可以在 ansible 配置文件中添加以下部分 ansible.cfg

[defaults]
host_key_checking=False

关于linux - 无法通过 Ansible ping 我的远程计算机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40866213/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com