-1

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.

I have used Mitogen for speed up. Please see the below logs getting while running the ansible ping command with -vvv.

Following is Logs:

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

Error message:

*uat | UNREACHABLE! => {
    "changed": false, 
    "msg": "EOF on stream; last 100 lines received:\nssh_exchange_identification: Connection closed by remote host\r", 
    "unreachable": true
}*
  • 2
    You should edit [your previous question](https://stackoverflow.com/q/62465429/13317) to add information and answer questions, rather than opening a new question on the same issue. – Kenster Jun 22 '20 at 11:30

2 Answers2

0

This is kind of unusual issue. If you've established a successful SSH connection, then this shouldn't happen. Make sure if all the hosts are added in the inventory file which you're trying to ping or try adding plugins in your inventory file, enable ini plugin. enable_plugins = ini

Mizkax
  • 55
  • 2
  • 8
  • I can do ansible ping using ubuntu user but could not ping using root user or buildbuildkite-agent user – Nawaraj Singh Thakuri Jun 22 '20 at 12:00
  • Oh, it generally comes when ssh connection is not established with root of host machine. Can you check if ssh connection is established between user to user or user to root or root to root? @NawarajSinghThakuri – Mizkax Jun 22 '20 at 13:25
0

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.

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

Verify Mitogen version and try commenting it in ansible.cfg file

Reference link: https://mitogen.networkgenomics.com/ansible_detailed.html#noteworthy-differences

CRDias
  • 114
  • 3