added some test

pull/83388/head
Thomas Wang 6 months ago committed by s-hertel
parent 4a285808b0
commit 6ab80968cc

@ -0,0 +1,20 @@
- hosts: testhost,testhost2
gather_facts: false
any_errors_fatal: true
tasks:
- block:
- debug:
msg: Some task running for all hosts
- fail:
run_once: true
- name: any_errors_fatal fails all hosts when any of them fails
debug:
msg: SHOULD NOT HAPPEN
rescue:
- name: Rescues both hosts
debug:
msg: rescuedd
- name: You can recover from fatal errors by adding a rescue section to the block.
debug:
msg: recovered

@ -47,3 +47,8 @@ ansible-playbook -i inventory "$@" 80981.yml | tee out.txt
[ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ]
[ "$(grep -c 'rescuedd' out.txt)" -eq 2 ]
[ "$(grep -c 'recovered' out.txt)" -eq 2 ]
ansible-playbook -i inventory "$@" 83292.yml | tee out.txt
[ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ]
[ "$(grep -c 'rescuedd' out.txt)" -eq 2 ]
[ "$(grep -c 'recovered' out.txt)" -eq 2 ]

Loading…
Cancel
Save