Passing free-form commands to Ansible using complex-args form
Solution 1:
Short answer: Don't use the command
, raw
, script
, or shell
modules. Write your own module that accepts the command as a "normal" argument.
Long answer:
In most cases, you can do this:
- shell: echo hello_world > /tmp/something
args:
creates: /tmp/something
However, this fails in some edge cases:
- shell: echo hello_world > creates=something
args:
creates: creates=something # The file is named "creates=something"
I don't know of a general way to handle this, but a bash-specific solution is:
- shell: echo hello_world > "creates=something"
args:
creates: creates=something