The whole play will only fail and abort the run when all hosts in the batch have failed.
(If serial: 10 is set for a rolling update, the batch size is 10, for example, otherwise it’s the size of the group).
The whole play will only fail and abort the run when all hosts in the batch have failed.
(If serial: 10 is set for a rolling update, the batch size is 10, for example, otherwise it’s the size of the group).
That’s actually the problem. Since each play can target different servers, “all hosts” should include hosts in all plays. It should not abort the run because all hosts of ONE play failed. Other plays don’t get a chance to run. For example, I have 2 db servers and 5 web servers and 2 lb servers. Because all the db servers failed (or were shut down already), it aborted the run so none of the web server will be shut down properly.
“That’s actually the problem. Since each play can target different servers, “all hosts” should include hosts in all plays. It should not abort the run because all hosts of ONE play failed.”
I disagree, but in this case you may wish to execute playbooks with multiple ansible-playbook calls.
You may also want to consider just issuing the shutdown against the ‘all’ group, if that was your intent.
Possibly like so:
ansible-playbook foo.yml; ansible-playbook bar.yml
I’ll probably make my own post because this post is so old, but it is the same topic, so…
Is there a way to avoid aborting the run when all hosts in a serial batch have failed?
No, that is the 'serial' feature itself, to kill play if all the hosts
in a batch fail.