-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"rescue" is not called if the failure of one host with "any_errors_fatal " option on block level #14024
Comments
Closing This TicketHi! We believe the above commit should resolve this problem for you. This will also be included in the next release. If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:
Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved. Thank you! |
For the record, here's my test: # cat inv h1 ansible_connection=local h2 ansible_connection=local h3 ansible_connection=local h4 ansible_connection=local h5 ansible_connection=local # cat test.yml - hosts: all gather_facts: no tasks: - block: - fail: when: inventory_hostname == 'h3' rescue: - debug: msg="here we are in the rescue" any_errors_fatal: yes When run: # ansible-playbook -vvv test.yml -i inv Using /etc/ansible/ansible.cfg as config file 1 plays in test.yml PLAY *************************************************************************** TASK [fail] ******************************************************************** task path: /root/testing/14024/test.yml:5 skipping: [h2] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true} fatal: [h3]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {}, "module_name": "fail"}, "msg": "Failed as requested from task"} skipping: [h4] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true} skipping: [h1] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true} skipping: [h5] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true} TASK [debug] ******************************************************************* task path: /root/testing/14024/test.yml:8 ok: [h1] => { "msg": "here we are in the rescue" } ok: [h2] => { "msg": "here we are in the rescue" } ok: [h3] => { "msg": "here we are in the rescue" } ok: [h4] => { "msg": "here we are in the rescue" } ok: [h5] => { "msg": "here we are in the rescue" } PLAY RECAP ********************************************************************* h1 : ok=1 changed=0 unreachable=0 failed=0 h2 : ok=1 changed=0 unreachable=0 failed=0 h3 : ok=1 changed=0 unreachable=0 failed=0 h4 : ok=1 changed=0 unreachable=0 failed=0 h5 : ok=1 changed=0 unreachable=0 failed=0 |
Instead of bombing out of the strategy, we now properly mark hosts failed so that the play iterator can handle block rescue/always properly. Fixes #14024
Hi,
As seen on this thread:
https://groups.google.com/forum/#!topic/ansible-project/pUuPNPtuz9c
On the "devel" branch the option "any_errors_fatal" on a block level should (if a single node fails) have all nodes to fail and then execute "rescue" in all nodes.
In the last "devel" version , yet if the option is accepted (in current 2.0.0 the option is just not accepted on block level) and all nodes are marked as failed the "rescue" part is not executed in any of them. Instead the execution just stops.
In the previous example if the "/tmp/testfolder1" fails in any node, "/tmp/testfolder2" will not be created either, as rescue will not be executed.
Without the option "any_errors_fatal" (with a single host) the "rescue" part will be executed.
The text was updated successfully, but these errors were encountered: