# Is there any way to make an SSH connection error a fatal error, that stops the play?

**URL:** <https://forum.ansible.com/t/is-there-any-way-to-make-an-ssh-connection-error-a-fatal-error-that-stops-the-play/16871>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [November 25, 2014, 2:30am UTC](https://forum.ansible.com/t/is-there-any-way-to-make-an-ssh-connection-error-a-fatal-error-that-stops-the-play/16871 "2014-11-25T02:30:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duncan\_Lock](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Duncan\_Lock](https://forum.ansible.com/u/Duncan_Lock)\
**Post date:** [November 25, 2014, 2:30am UTC](https://forum.ansible.com/t/is-there-any-way-to-make-an-ssh-connection-error-a-fatal-error-that-stops-the-play/16871/1 "2014-11-25T02:30:04Z")

</div>

Occasionally, I get SSH timeouts or other network errors in the middle of a play. These cause that task to fail, but not the whole playbook, which continues on, but without the node that failed. You see output something like this:

…

2014-11-24 23:54:08,717 p=21193 u=ubuntu | TASK: [common | Install latest pip from PyPi] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
2014-11-24 23:54:12,034 p=21193 u=ubuntu | changed: [box0]

**2014-11-24 23:54:09,443 p=21193 u=ubuntu | fatal: [box1] =\> SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue**  
2014-11-24 23:54:11,001 p=21193 u=ubuntu | changed: [box2]  
2014-11-24 23:54:11,278 p=21193 u=ubuntu | changed: [box3]  
2014-11-24 23:54:12,305 p=21193 u=ubuntu | changed: [box4]

…

You eventually get this at the bottom of the output:

box0: ok=29 changed=23 unreachable=0 failed=0  
box1: ok=18 **changed=15 unreachable=1** failed=0  
box2: ok=77 changed=61 unreachable=0 failed=0  
box3: ok=77 changed=62 unreachable=0 failed=0  
box4: ok=77 changed=62 unreachable=0 failed=0

This means that box1 doesn’t get anything that should have happened after the task that failed, because it got dropped from the play - and all groups - at that point.

This means that I occasionally get one cluster node that doesn’t work properly, because it was only partially provisioned/setup.

Is there a way to make this SSH error fatal and to stop the whole playbook/ansible run at that point - the same way an error in a task itself would?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 25, 2014, 9:02pm UTC](https://forum.ansible.com/t/is-there-any-way-to-make-an-ssh-connection-error-a-fatal-error-that-stops-the-play/16871/2 "2014-11-25T21:02:17Z")

</div>

check this setting, I believe it will allow you to do what you want  
[http://docs.ansible.com/playbooks\_delegation.html#maximum-failure-percentage](http://docs.ansible.com/playbooks_delegation.html#maximum-failure-percentage)

---

<div class="post-metadata">

**Author:** ![Duncan\_Lock](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Duncan\_Lock](https://forum.ansible.com/u/Duncan_Lock)\
**Post date:** [December 3, 2014, 10:42pm UTC](https://forum.ansible.com/t/is-there-any-way-to-make-an-ssh-connection-error-a-fatal-error-that-stops-the-play/16871/3 "2014-12-03T22:42:00Z")

</div>

Thanks!
