mirror of https://github.com/ansible/ansible.git
any_errors_fatal fixes (#78680)
Fixes #31543 Fixes #36308 Fixes #73246 Fixes #80981 Fixes #81533 ci_completepull/82074/head
parent
c827dc0dab
commit
fe94a99aa2
@ -0,0 +1,6 @@
|
||||
bugfixes:
|
||||
- Fix for when ``any_errors_fatal`` was ignored if error occured in a block with always (https://github.com/ansible/ansible/issues/31543)
|
||||
- Fix ``force_handlers`` not working with ``any_errors_fatal`` (https://github.com/ansible/ansible/issues/36308)
|
||||
- Fix tasks in always section not being executed for nested blocks with ``any_errors_fatal`` (https://github.com/ansible/ansible/issues/73246)
|
||||
- "``any_errors_fatal`` should fail all hosts and rescue all of them when a ``rescue`` section is specified (https://github.com/ansible/ansible/issues/80981)"
|
||||
- Fix issues when tasks withing nested blocks wouldn't run when ``force_handlers`` is set (https://github.com/ansible/ansible/issues/81533)
|
@ -0,0 +1,12 @@
|
||||
- hosts: testhost,testhost2
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- block:
|
||||
- fail:
|
||||
when: inventory_hostname == 'testhost'
|
||||
always:
|
||||
- debug:
|
||||
|
||||
- debug:
|
||||
msg: SHOULD NOT HAPPEN
|
@ -0,0 +1,14 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
force_handlers: true
|
||||
tasks:
|
||||
- command: echo
|
||||
notify:
|
||||
- handler1
|
||||
|
||||
- fail:
|
||||
handlers:
|
||||
- name: handler1
|
||||
debug:
|
||||
msg: handler1 ran
|
@ -0,0 +1,11 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- block:
|
||||
- block:
|
||||
- fail:
|
||||
always:
|
||||
- block:
|
||||
- debug:
|
||||
msg: PASSED
|
@ -0,0 +1,17 @@
|
||||
- hosts: testhost,testhost2
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- block:
|
||||
- fail:
|
||||
when: inventory_hostname == "testhost"
|
||||
- name: any_errors_fatal fails all hosts when any of them fails
|
||||
debug:
|
||||
msg: SHOULD NOT HAPPEN
|
||||
rescue:
|
||||
- name: Rescues both hosts
|
||||
debug:
|
||||
msg: rescue
|
||||
- name: You can recover from fatal errors by adding a rescue section to the block.
|
||||
debug:
|
||||
msg: recovered
|
@ -0,0 +1,16 @@
|
||||
- hosts: A,B
|
||||
gather_facts: false
|
||||
force_handlers: true
|
||||
tasks:
|
||||
- fail:
|
||||
when: inventory_hostname == "A"
|
||||
|
||||
- run_once: true
|
||||
block:
|
||||
- debug:
|
||||
msg: task1
|
||||
- debug:
|
||||
msg: task2
|
||||
|
||||
- debug:
|
||||
msg: hosts_left
|
@ -0,0 +1,12 @@
|
||||
- hosts: A,B
|
||||
gather_facts: false
|
||||
force_handlers: true
|
||||
tasks:
|
||||
- fail:
|
||||
when: inventory_hostname == "A"
|
||||
|
||||
- meta: clear_host_errors
|
||||
when: false
|
||||
|
||||
- debug:
|
||||
msg: hosts_left
|
Loading…
Reference in New Issue