Using "free-form" arguments with the complex-arg passing syntax

807 views
Skip to first unread message

Charles Duffy

unread,
Mar 23, 2014, 7:11:29 PM3/23/14
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Mar 24, 2014, 11:23:59 AM3/24/14
to ansible...@googlegroups.com
There's no parameter named "free_form" to this module.

In the docs, this just means that the argument is a string.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/23e9664b-2246-494a-b5ce-6c12e4fbbef5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages