Aborting entire playbook when one host unreachable

49 views
Skip to first unread message

Gustav Karlsson

unread,
Sep 8, 2016, 11:29:07 AM9/8/16
to Ansible Project
Hi,

We are using an ansible (v 2.0.2) playbook for deployment of our webapp. A simplified example of what we are doing is: 

Play 1 - db
- Expand the database schema to support new version of the webapp.

Play 2 - appservers
- Deploy new version of the webapps as a rolling update.


The problem we are facing is that if Play 1 fails because the host is unreachable, Play 2 still executes, deploying new versions of the webapp using a schema not yet in the database. We would ideally abort the entire playbook when this happens, in effect canceling the deploy.  (Unreachable hosts currently happen very sporadically due to some unknown issue with the ssh-config or environment.)


Is there a way to abort the entire playbook (even hackish solutions)?
If not, is there a way to check the results from a previous play?
Is there a better way to solve this type of issue?

We have tried 'max_fail_percentage: 0', 'any_errors_fatal: true' and some more hackish solutions, but there just do not seem to be a way...


Thankful for any help here :)

Regards,
Gustav

Benjamin Redling

unread,
Sep 13, 2016, 9:22:55 AM9/13/16
to ansible...@googlegroups.com
On 09/08/2016 08:15, Gustav Karlsson wrote:
> Is there a way to abort the entire playbook (even hackish solutions)?
[...]
> We have tried 'max_fail_percentage: 0', 'any_errors_fatal: true' and
> some more hackish solutions, but there just do not seem to be a way...

Can you elaborate what you miss from any_erros_fatal?

According to
http://docs.ansible.com/ansible/playbooks_error_handling.html#aborting-the-play
that should be a viable solution.

Regards,
Benjamin
--
FSU Jena | JULIELab.de/Staff/Benjamin+Redling.html
vox: +49 3641 9 44323 | fax: +49 3641 9 44321
Reply all
Reply to author
Forward
0 new messages