Ansible 通过跳转服务器从主机 ping 到远程服务器时出错 [英] Got an error while Ansible ping from host to remote server via jump server
问题描述
我在尝试运行命令时出错 "ansible -m ping uat"但我可以通过跳转服务器从我的主机 ssh 到远程服务器.
I got an error while trying to run a command " ansible -m ping uat" but I can ssh from my host computer to remote server via jump server.
我使用 Mitogen 来加速.请查看使用 -vvv 运行 ansible ping 命令时获取的以下日志.
I have used Mitogen for speed up. Please see the below logs getting while running the ansible ping command with -vvv.
以下是日志:
ansible 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/buildkite-agent/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Apr 15 2020, 17:07:12) [GCC 5.4.0 20160609]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[top 2214] 09:24:54.188656 D ansible_mitogen.affinity: CPU mask for Ansible top-level process: 0x000001
[top 2214] 09:24:54.189123 D ansible_mitogen.process: inherited open file limits: soft=1024 hard=1048576
[top 2214] 09:24:54.189331 D ansible_mitogen.process: raised soft open file limit from 1024 to 1048576
[mux 2220] 09:24:54.191415 D ansible_mitogen.affinity: CPU mask for MuxProcess 0: 0x000001
[mux 2220] 09:24:54.198012 D mitogen.service: Pool(b090, size=32, th='MainThread'): initialized
[mux 2220] 09:24:54.198853 D ansible_mitogen.process: Service pool configured: size=32
META: ran handlers
[task 2254] 09:24:54.251656 D ansible_mitogen.affinity: CPU mask for WorkerProcess: 0x000001
[task 2254] 09:24:54.277281 D ansible_mitogen.process: will use multiplexer 0 (/tmp/mitogen_unix_TcnPxD.sock) to connect to "uat"
[task 2254] 09:24:54.277627 D mitogen.unix: client: connecting to /tmp/mitogen_unix_TcnPxD.sock
[mux 2220] 09:24:54.278489 D mitogen.unix: listener: accepted connection from PID 2254: unix_client.2254
[task 2254] 09:24:54.278822 D mitogen.unix: client: local ID is 1, remote is 0
[mux 2220] 09:24:54.281714 D mitogen.parent: creating connection to context 2 using mitogen.ssh
[mux 2220] 09:24:54.414368 D mitogen.parent: command line for Connection(None): ssh -o "LogLevel ERROR" -o "Compression yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 10" -o "BatchMode yes" -o "StrictHostKeyChecking yes" -C -o ControlMaster=auto -o ControlPersist=60s -o "ProxyCommand=ssh -W %h:%p -q 34.104.54.8" 54.64.243.180 /usr/bin/python -c "'import codecs,os,sys;_=codecs.decode;exec(_(_(\"eNqFkcFLwzAUxs/rX9HbSzDd0o4hFALKDuJBhCLuoEPaJdWwLglpuzr/et86ce08CDm8H9/38j3ey9hK2HrqtFOEBp51A9JliFBavyU0DSZYy9YlhLOYc3rmjA3JoxqfeFPZWpFsCH4IqyF0CBhYHzC+yhtM3YVChCBz32kDYW5kL6pPtWmbvKhUL8/a2s8KbWbu0HxYAzjn5MJ2JfrGvfK1tuYlna/7WGX22iPDbXb3zGEtxm0nD2JFxgIb4xWQnW7suzJp0epKbnWjohyxudEuinnEozm+RZokCadAA/y282giMYOH+6dHzvmrARxnYyVunQZL8UaOe5fWKYPbBl8AnXqVSxJf82RBGXxphz+VTpx9KwZdAcdTlO4nYNnXp/VeuLv/3H+njMdT/h4uod9dUrTr\".encode(),\"base64\"),\"zip\"))'"
[mux 2220] 09:24:54.419761 D mitogen.parent: child for Connection(None) started: pid:2258 stdin:77 stdout:77 stderr:79
[mux 2220] 09:24:54.526474 D mitogen.parent: ssh.54.64.243.180: (unrecognized): ssh_exchange_identification: Connection closed by remote host
[mux 2220] 09:24:54.526830 D mitogen: <Side of ssh.54.64.243.180 fd 77>: empty read, disconnecting
[mux 2220] 09:24:54.527372 D mitogen: BootstrapProtocol(ssh.54.64.243.180): disconnecting
[mux 2220] 09:24:54.527801 D mitogen: <Side of ssh.54.64.243.180 fd 79>: empty read, disconnecting
[mux 2220] 09:24:54.528086 D mitogen.parent: failing connection ssh.54.64.243.180 due to EofError(u'EOF on stream; last 100 lines received:\nssh_exchange_identification: Connection closed by remote host\r',)
[mux 2220] 09:24:54.528393 D mitogen.parent: PopenProcess ssh.54.64.243.180 pid 2258: exited with return code 255
[mux 2220] 09:24:54.528581 D mitogen: SetupProtocol(ssh.54.64.243.180): disconnecting
[mux 2220] 09:24:54.529214 D mitogen: SetupProtocol(ssh.54.64.243.180): disconnecting
[task 2254] 09:24:54.529820 D ansible_mitogen.mixins: _remove_tmp_path(None)
[task 2254] 09:24:54.530132 D mitogen: MitogenProtocol(unix_listener.2220): disconnecting
[task 2254] 09:24:54.530568 D mitogen: Waker(fd=11/12): disconnecting
[task 2254] 09:24:54.530990 D mitogen: Router(Broker(b290)): stats: 0 module requests in 0 ms, 0 sent (0 ms minify time), 0 negative responses. Sent 0.0 kb total, 0.0 kb avg.
[mux 2220] 09:24:54.531810 D mitogen: <Side of unix_client.2254 fd 76>: empty read, disconnecting
[mux 2220] 09:24:54.532045 D mitogen: MitogenProtocol(unix_client.2254): disconnecting
错误信息:
*uat | UNREACHABLE! => {
"changed": false,
"msg": "EOF on stream; last 100 lines received:\nssh_exchange_identification: Connection closed by remote host\r",
"unreachable": true
}*
推荐答案
我可以看到一些 mitogen 条目您是否在默认设置中使用 mitogen 作为 strategy_plugin?建议尝试在您的 ansible.cfg 文件中注释 (strategy_plugin, strategy).
I can see some mitogen entries are you using mitogen as a strategy_plugin in your defaults? Suggest to try commenting that(strategy_plugin, strategy) in your ansible.cfg file.
从日志来看,您似乎运行的是 Ansible 2.9.9 版.Mitogen 0.2.9 版似乎适用于 Ansible 2.3-2.8 以及 Python 2.6、2.7、3.6 和 3.7
By the looks of the logs you seem to be running Ansible version 2.9.9. Mitogen version 0.2.9 seems to work for Ansible 2.3-2.8 along with Python 2.6, 2.7, 3.6 and 3.7
验证 Mitogen 版本并尝试在 ansible.cfg 文件中对其进行注释
Verify Mitogen version and try commenting it in ansible.cfg file
参考链接:https://mitogen.networkgenomics.com/ansible_detailed.html#值得注意的差异
这篇关于Ansible 通过跳转服务器从主机 ping 到远程服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!