Discussion:
[ansible-project] how to abort execution upon a single fail on any host
Serge van Ginderachter
2015-07-29 12:54:28 UTC
Permalink
​Perhaps ​any_errors_fatal: true might help?

(btw Seems undocumented)
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEhzMJAgmEEOPW_bQN2aQGQ5mP3THtarnUXd6Y4GEfz1Y11i0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Leon Xie
2015-07-29 13:39:21 UTC
Permalink
my ansible version is as below:

$ ansible-playbook --version
ansible-playbook 1.9.1
configured module search path = None
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9e33df9a-4de7-4971-ad17-51166c80045f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Leon Xie
2015-07-29 13:15:15 UTC
Permalink
thanks a lot for your suggestion.
I had a try by adding any_errors_fatal: true.
however, it doesn't work.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- hosts: aa
max_fail_percentage: 0
any_errors_fatal: true
roles:
- stop_server

- hosts: allhosts
max_fail_percentage: 0
roles:
- backup_data
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++++++++++
PLAY [aa]
********************************************************************

TASK: [stop_server | stop server] ***************************************
failed: [xxx.xxx.0.xx] => {"attempts": 1, "changed": true, "cmd":
["xxxxxxx"], "delta": "0:00:00.006697", "end": "2015-07-29
21:04:35.801786", "failed": true, "rc": 255, "start": "2015-07-29
21:04:35.795089", "warnings": []}
msg: Task failed as maximum retries was encountered

PLAY [allhosts]
******************************************************************

TASK: [backup_data | create directory] ***************************
ok: [xx.xxx.0.xx]
ok: [xx.xxx.0.xx]

TASK: [backup_data | mount directory] *************************************
skipping: [xx.xxx.0.xx]
skipping: [xx.xxx.0.xx]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

On Wednesday, July 29, 2015 at 8:54:59 PM UTC+8, Serge van Ginderachter
Post by Serge van Ginderachter
​Perhaps ​any_errors_fatal: true might help?
(btw Seems undocumented)
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/38c6a052-ed86-4238-9021-7e275beda62a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Leon Xie
2015-07-29 14:24:34 UTC
Permalink
Hi Serge,

your suggestion about any_errors_fatal works for the hosts that in a single
play.
if there is another play and one of the hosts in the play is not in the
hosts that marked as any_errors_fatal, the tasks in this play will also be
executed.


On Wednesday, July 29, 2015 at 8:54:59 PM UTC+8, Serge van Ginderachter
Post by Serge van Ginderachter
​Perhaps ​any_errors_fatal: true might help?
(btw Seems undocumented)
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d1698750-6695-4843-9843-548c1f58df78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...