Created
May 6, 2018 04:16
-
-
Save skamithi/5da62ca94b97be4dbfb2748b18a517fa to your computer and use it in GitHub Desktop.
block rescue
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: linuxsimbasvr | |
gather_facts: no | |
tasks: | |
- block: | |
- name: create tempfile | |
tempfile: | |
state: file | |
suffix: ".file.tmp" | |
register: mytmpfile | |
- name: write something cool to the tempfile | |
template: | |
src: "coolstuff.j2" | |
dest: "{{ mytmpfile.path }}" | |
rescue: | |
- name: delete the tempfile if it was created | |
file: | |
state: absent | |
path: "{{ mytmpfile.path }}" | |
when: mytmpfile is defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment