Howdy, all –
I’m generating Ansible playbooks programmatically, and using the complex-args form documented by example at https://github.com/ansible/ansible-examples/blob/master/language_features/complex_args.yml.
This works well until I try to use a module accepting “free-form” arguments, such as the command or shell modules. (I prefer to use this syntax in such cases to avoid ambiguity around whether arguments containing the literal ‘=’ character are intended to be parsed by Ansible or by the shell being invoked).
For instance, although http://docs.ansible.com/shell_module.html describes a “free_form” argument as being the appropriate place to pass the actual command to be run, I’m seeing the following behavior in practice:
action: shell
args:
free_form: echo hello_world >/tmp/something
creates: /tmp/something
…runs the following:
`
/bin/sh -c " free_form='echo hello_world >/tmp/something' "
`…which is very much not the intent. What’s the right way to pass a free-form argument when using the complex-args form?
PS - I posted this question to ServerFault at http://serverfault.com/questions/584037/passing-free-form-commands-to-ansible-using-complex-args-form; hopefully the cross-posting is not frowned on.