Aborting entire playbook when one host unreachable

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 :slight_smile:

Regards,
Gustav

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