Last active
July 14, 2018 05:30
-
-
Save YumaInaura/a7ed9cca63be318457f5d938ac5639e3 to your computer and use it in GitHub Desktop.
Ansible playbook example of script module using creates / removes args
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: | |
- example | |
tasks: | |
- name: This task will be run because trigger.txt not exists | |
script: files/echo.sh | |
args: | |
creates: trigger.txt # run only when file exist | |
changed_when: no | |
- name: This task will be skipped because trigger.txt not exists | |
script: files/echo.sh | |
args: | |
removes: trigger.txt # run only when file not exist | |
changed_when: no | |
- name: Touch trigger.txt | |
file: | |
path: trigger.txt | |
state: touch | |
- name: This task will be skipped because trigger.txt exists | |
script: files/echo.sh | |
args: | |
creates: trigger.txt # run only when file exist | |
changed_when: no | |
- name: This task will be run because trigger.txt exists | |
script: files/echo.sh | |
args: | |
removes: trigger.txt # run only when file exist | |
changed_when: no | |
- name: Cleanup trigger.txt | |
file: | |
path: trigger.txt | |
state: absent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I will not able to remember stand creates / removes act...