with_items introduces a '#' when using escaped braces

31 views
Skip to first unread message

Andrew Carter

unread,
Mar 25, 2015, 1:17:51 PM3/25/15
to ansible...@googlegroups.com

Using Ansible 1.7.2 on Centos 6.6 (installed from EPEL), I'm trying to execute a command which contains escaped brackets. I get different results when I move the command into an items list. Here it is boiled down to a trivial example:

This works:

- shell: echo special {{ '{{' }} string {{ '}}' }} test

Verbose output shows Ansible executes this:
ESTABLISH CONNECTION FOR USER: root
REMOTE_MODULE command echo special {{ string }} test #USE_SHELL

However, this doesn't:

- shell: echo {{ item }}
  with_items:
    - special {{ '{{' }} string {{ '}}' }} test

When this same string is executed from a list of items, the resulting command has '#' characters in place of one bracket in each occurance:
ESTABLISH CONNECTION FOR USER: root
REMOTE_MODULE command echo special {# string #} test #USE_SHELL

Andrew Carter

unread,
Mar 25, 2015, 1:17:52 PM3/25/15
to ansible...@googlegroups.com

Anyone have a workaround?

Brian Coca

unread,
Mar 25, 2015, 1:19:48 PM3/25/15
to ansible...@googlegroups.com
this happens only on the returned output to prevent code injection, it
is not what ansible is sending.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages