# ssh connection is broken while running task.

**URL:** <https://forum.ansible.com/t/ssh-connection-is-broken-while-running-task/21148>\
**Category:** Ansible Project\
**Created:** [April 13, 2016, 5:57am UTC](https://forum.ansible.com/t/ssh-connection-is-broken-while-running-task/21148 "2016-04-13T05:57:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![selvam\_vasu](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvam\_vasu](https://forum.ansible.com/u/selvam_vasu)\
**Post date:** [April 13, 2016, 5:57am UTC](https://forum.ansible.com/t/ssh-connection-is-broken-while-running-task/21148/1 "2016-04-13T05:57:10Z")

</div>

Hi,  
I have playbook which has 4 tasks on that. The task are running on more than 10 remote hosts. The first two tasks are ever running without any problem. But when the third task is running, The am getting error like “SSH Error: mux\_client\_hello\_exchange: write packet: Broken pipe”. It is not happening always. It is happening at some times only and also it not happened for specific host. The issue is happening randomly on hosts list.

Ansible logs;

---

<div class="post-metadata">

**Author:** ![toshywoshy](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/toshywoshy/32/7855_2.png) [@toshywoshy](https://forum.ansible.com/u/toshywoshy)\
**Post date:** [April 18, 2016, 8:12am UTC](https://forum.ansible.com/t/ssh-connection-is-broken-while-running-task/21148/2 "2016-04-18T08:12:40Z")

</div>

> Hi,  
> I have playbook which has 4 tasks on that. The task are running on more  
> than 10 remote hosts. The first two tasks are ever running without any  
> problem. But when the third task is running, The am getting error like  
> "SSH Error: mux\_client\_hello\_exchange: write packet: Broken pipe". It is  
> not happening always. It is happening at some times only and also it not  
> happened for specific host. The issue is happening randomly on hosts list.
> 
> Ansible logs;  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
> 
> TASK: [create symbolic link to latest logstash package]  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> \<host1\> REMOTE\_MODULE file  
> path=/opt/installs/logstash/logstash-sdf\_current  
> src=/opt/installs/logstash/logstash-2.2.3 state=link force=yes  
> \<host1\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s  
> -o ControlPath="/home/sdf/.ansible/cp/ansible-ssh-%h-%p-%r" -o  
> KbdInteractiveAuthentication=no -o  
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o  
> PasswordAuthentication=no -o ConnectTimeout=10 host1 /bin/sh -c 'mkdir  
> -p $HOME/.ansible/tmp/ansible-tmp-1460458867.58-123380470331659 && chmod  
> a+rx $HOME/.ansible/tmp/ansible-tmp-1460458867.58-123380470331659 &&  
> echo $HOME/.ansible/tmp/ansible-tmp-1460458867.58-123380470331659'  
> fatal: [host1] =\> SSH Error: mux\_client\_hello\_exchange: write packet:  
> Broken pipe  
> It is sometimes useful to re-run the command using -vvvv, which prints  
> SSH debug output to help diagnose the issue.

mux\_client normally has to do with your ssh socket settings on your ansible mgmt host (local machine), they are controlled by the Control\* options.  
Check your local machine ssh config, increase ControlPersist, personally I think 60s is quite useless, you might be better off disabling ControlMaster, if you are not going to keep the socket up for the duration of you playbook.  
However check that the ControlPath folder exists "/home/sdf/.ansible/cp/" with the right permissions.

If the error persists, try the setup/ping module with full verbose  
" bin/ansible host1 -m setup -vvvv "
