如果问题不清楚和/或如果我没有问到我应该去哪里,请提前道歉。
我有问题,连接到主机与ansible通过SSH。它几天前就起作用了,但几天来我一直遇到相同的消息错误:
camille@ubuntu:~$ ansible all -m ping -u remote
192.xxx.xxx.xxx | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange\r\n",
"unreachable": true
}SSH连接(没有ansible)与工作良好,所以我并不真正理解这个问题。我正在Ubuntu16.04VM上运行Ansible,我想访问的主机是一个CentOS 7 VM。
我的主机文件如下:
[test]
192.xxx.xxx.xxx ansible_ssh_user=remote ansible_ssh_pass=password ansible_sudo_pass='password' #VM CentOS我尝试了解决方案,解释了here,但它没有解决问题。
编辑1:在尝试了开膛手解决方案并测试了其他一些东西之后,我的清单现在如下所示:
[test]
192.xxx.xxx.xxx ansible_connection=ssh ansible_user=remote ansible_password='password'
[test:vars]
proxy=my_proxy:8080我还试着把超时时间增加到25,我仍然有同样的问题。
编辑2:
在更改我的ansible.cfg文件后,错误消息已更改:
192.xxx.xxx.xxx | UNREACHABLE! => {
"changed": false,
"msg": "SSH Error: data could not be sent to remote host \"192.xxx.xxx.xxx\". Make sure this host can be reached over ssh",
"unreachable": true }我再次测试ssh连接,它仍然运行良好。
我的配置文件现在是:
[defaults]
timeout = 25
host_key_checking = False
roles_path = roles/
gathering = smart
[ssh_connection]
ssh_args = -o
ControlMaster=auto -o
ControlPersist=600s
control_path = %(directory)s/%%h-%%r
pipelining = True你有这方面的线索吗?
发布于 2018-04-09 12:08:03
我终于解决了我的问题!
再次感谢开膛手为您提供的时间和帮助:)
发布于 2018-04-03 12:07:55
尝试使用ansible_user代替ansible_ssh_user,使用ansible_password代替ansible_ssh_pass。这取决于您的ansible版本。此外,您可能需要将[group:vars]放在清单文件中的[group]部分之后。
有简单的方法来检查差异。
抗192.168.15.29 -i your_hosts_file -m ping -e "ansible_ssh_user=remote ansible_ssh_pass=password“
或
抗192.168.15.29 -i your_hosts_file -m ping -e "ansible_user=remote ansible_password=password“
发布于 2021-11-20 15:01:58
我只想把我的两分钱加到这个问题解决方案上:
有同样的问题,并且尝试了上面的所有东西,但是我的情况并不完全一样:当我尝试对多个主机做一些游戏时,我在不同的主机上随机地收到了这个错误。
为了解决这个问题,我不得不将并发级别从“串行:否”降低到“串行: 4”。并发执行的次数取决于网络吞吐量,应该通过实验或彻底地挖掘和计算操作系统和硬件的细节。如果您使用的话,它也肯定涉及到您的堡垒主机上的网络和可能的分叉号。
我希望这能对像我这样的人有所帮助。
https://stackoverflow.com/questions/49629480
复制相似问题