So “only_if” is the old way do conditionals, we have “when:” in 1.2 (the “when_integer” and so on were a stopgap in 1.1).
Anyway, it executes locally, not remotely.
It seems like you can benefit from the “creates=” and “removes=” parameters to the command and shell modules for what you want to do as long as it involves file existence/absence.
What you want is already built into the command module. See the "creates" option.
- name: do something
command: do_something.sh creates=/path/to/result.file
Thank you, it works!
But, these "creates" and "removes" are little misunderstanding names I think.
How about "if_exists" and "not_exists" ?