Last active
March 15, 2021 02:38
-
-
Save evrardjp/564ebf6c18d335c3f8d5eaad639870c1 to your computer and use it in GitHub Desktop.
block/rescue removes host from ansible_play_hosts when block fails, even when rescued!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
connection: local | |
gather_facts: no | |
tasks: | |
- debug: | |
var: ansible_play_hosts | |
- block: | |
- fail: | |
msg: "Failure" | |
when: | |
- "inventory_hostname == 'localhost'" | |
rescue: | |
- debug: | |
msg: "Success" | |
always: | |
- debug: | |
var: ansible_play_hosts |
Author
evrardjp
commented
Oct 13, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment