# SSH Connection Error Playbook Continues

**URL:** <https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749>\
**Category:** Ansible Developer\
**Created:** [November 12, 2015, 3:59pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749 "2015-11-12T15:59:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phill\_Tomlinson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Phill\_Tomlinson](https://forum.ansible.com/u/Phill_Tomlinson)\
**Post date:** [November 12, 2015, 3:59pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749/1 "2015-11-12T15:59:11Z")

</div>

Hi,

I’d like to clarify some functionality. When running a playbook with multiple plays and one play can’t connect to a host, ansible displays an error:

**PLAY [First Play] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***  
**fatal: [remote-host]: UNREACHABLE! =\> {“changed”: false, “msg”: “ERROR! 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”, “unreachable”: true}**

**PLAY [Next Play] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

This is fine as the host can’t be connected however rather than stopping the playbook execution it continues. My question is:

1. If the playbook can’t connect to a host shouldn’t it fail fast and stop?
2. Or is this expected behaviour? In that it fails the first play as it can’t connect to the remote-host but then continues to the next play to see if that works.

If point 2) is true is there a setting to exit the whole playbook on this type or error?

Thanks,  
Phill

---

<div class="post-metadata">

**Author:** ![marc.petrivelli](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marc.petrivelli/32/3773_2.png) [@marc.petrivelli](https://forum.ansible.com/u/marc.petrivelli)\
**Post date:** [November 12, 2015, 4:50pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749/2 "2015-11-12T16:50:27Z")

</div>

The playbook will continue but not for plays/tasks that target “remote-host”. If you want your playbook to bail out immediately checkout [http://docs.ansible.com/ansible/playbooks\_delegation.html#maximum-failure-percentage](http://docs.ansible.com/ansible/playbooks_delegation.html#maximum-failure-percentage)

---

<div class="post-metadata">

**Author:** ![Phill\_Tomlinson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Phill\_Tomlinson](https://forum.ansible.com/u/Phill_Tomlinson)\
**Post date:** [November 12, 2015, 5:58pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749/3 "2015-11-12T17:58:55Z")

</div>

Thanks but that says it only aborts the play, not the other plays in the playbook.

Is there another setting that can abort the playbook on a host failure?

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [November 12, 2015, 5:59pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749/4 "2015-11-12T17:59:45Z")

</div>

When a play is aborted in this fashion, it’s considered a fatal error to the entire ansible-playbook run. It’s a full dead stop.

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [December 4, 2015, 6:52pm UTC](https://forum.ansible.com/t/ssh-connection-error-playbook-continues/19749/5 "2015-12-04T18:52:53Z")

</div>

What is your inventory ?
