# Ansible cannot connect via SSH / broken pipe problem

**URL:** <https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604>\
**Category:** Ansible Project\
**Created:** [September 19, 2018, 9:09am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604 "2018-09-19T09:09:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Eromenko](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_Eromenko](https://forum.ansible.com/u/Alexey_Eromenko)\
**Post date:** [September 19, 2018, 9:09am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/1 "2018-09-19T09:09:06Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [September 19, 2018, 9:19am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/2 "2018-09-19T09:19:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alexey\_Eromenko](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_Eromenko](https://forum.ansible.com/u/Alexey_Eromenko)\
**Post date:** [September 19, 2018, 9:27am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/3 "2018-09-19T09:27:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [September 19, 2018, 10:02am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/4 "2018-09-19T10:02:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alexey\_Eromenko](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_Eromenko](https://forum.ansible.com/u/Alexey_Eromenko)\
**Post date:** [September 19, 2018, 10:08am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/5 "2018-09-19T10:08:53Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Alexey\_Eromenko](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_Eromenko](https://forum.ansible.com/u/Alexey_Eromenko)\
**Post date:** [September 20, 2018, 12:10am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/6 "2018-09-20T00:10:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 20, 2018, 5:28am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/7 "2018-09-20T05:28:27Z")

</div>

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](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#release-status)

---

<div class="post-metadata">

**Author:** ![Alexey\_Eromenko](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_Eromenko](https://forum.ansible.com/u/Alexey_Eromenko)\
**Post date:** [September 22, 2018, 3:14am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/8 "2018-09-22T03:14:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 22, 2018, 7:51am UTC](https://forum.ansible.com/t/ansible-cannot-connect-via-ssh-broken-pipe-problem/28604/9 "2018-09-22T07:51:05Z")

</div>

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
