mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
499 B
YAML
18 lines
499 B
YAML
1 year ago
|
- 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
|