I’ve been looking arround trying to find a way, with no luck.
When running a playbook against multiple nodes (say 5), and one of them fail a task (or block), I would like the other 4 nodes to run different tasks than the ones they would run if non of the nodes fail.
Is there any way to signal those nodes or to send them a variable which I could use to choose the actions to be taken?
The case of use is that if something fails in any host, I would like to “undo” what I have already done…
In 2.0.1, we’re going to allow the use of any_errors_fatal at the block level, so you can simply do this:
block:
task1: …
task2: …
…
taskN: …
rescue:
undo_taskN: …
…
undo_task2: …
undo_task1: …
any_errors_fatal: yes
However, there is currently a bug in 2.0.0.x where any_errors_fatal is not working as stated in the documentation, so you’ll have to wait until we get 2.0.1 out to do this.
Yes it seems something is different regarding this on devel branch. But either I don’t understand what it does or something is not right.
In the current version (2.0.0.0) if I try to use “any_errors_fatal” in a block level it fails because this is not an option to be usable on a block.
With the devel branch this changes. Now I can use this option but it doesn’t do what I was expecting.
Now if one of the hosts fails, it make the rest fail and stop executing the playbook. But I am not able to have it execute the “rescue” part.