Ansible cannot connect via SSH / broken pipe problem

fatal: [finland-07]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: mux_client_hello_exchange: write packet: Broken pipe\r\n”, “unreachable”: true}
fatal: [finland-08]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: mux_client_hello_exchange: write packet: Broken pipe\r\n”, “unreachable”: true}

Any ideas why ?

This usually means a network-level failure rather than a DNS or protocol failure.

Look at the addressing information for whatever the finland-7 host is.

  • if it is a name, can you resolve it (on whatever host is doing the ssh)?

  • if it does resolve, is the IP address an address that should be able to be reached (from the host doing the ssh)?

  • if should be reachable, is it actually reachable (from the host doing the ssh)?

Regards, K.

All the hosts are reachable by IP address. And hosts list is part of
my ansible script.

Are they reachable from the host where the ssh client is running?

Is the host “finland-7” definitely the host you think it is?
Is the name or IP address of that host definitely what you think it is?
Is the host you think ssh is running on definitely the host it is actually running on?

Sherlock Holmes said that when you have eliminated the impossible, whatever remains, however improbable, must be the truth.

Ansible is telling you the host is unreachable. There is something you don’t know. Check everything.

Regards, K.

Are they reachable *from the host where the ssh client is running*?

Is the host "finland-7" definitely the host you think it is?
Is the name or IP address of that host definitely what you think it is?
Is the host you think ssh is running on definitely the host it is actually running on?

From my file, "hosts":

finland-07 ansible_host=95.216.19.219 ansible_port=22
finland-08 ansible_host=95.216.21.109 ansible_port=22
Basically ALL connects go via IP address, NOTHING goes via SSH.

Sherlock Holmes said that when you have eliminated the impossible, whatever remains, however improbable, must be the truth.

Yes, manual SSH connection to IP 95.216.19.219 of finland-07 works great.

Ansible is telling you the host is unreachable. There is something you don't know. Check everything.

And it works on the next run...
Ansible works on the next run, with a different set of hosts failing
to connect at random.

opened bug:
Ansible cannot connect via SSH / broken pipe problem #45833
https://github.com/ansible/ansible/issues/45833

You need to at least upgrade Ansible before filing a issue, version 2.2 isn't supported anymore.

https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#release-status

Were there any changes between v2.2 and v2.5 regarding SSH connect module ?

Number of commits that has changed the file:

$ git log --oneline origin/stable-2.2..origin/stable-2.5 -- lib/ansible/plugins/connection/ssh.py | wc -l
45

$ git log --oneline origin/stable-2.2..origin/stable-2.6 -- lib/ansible/plugins/connection/ssh.py | wc -l
50