Hi,
I have a requirement to render a jinja template which starts and ends with
square brackets and expands some variables. I'm finding that Ansible
interprets the result as a YAML list but I need Ansible to treat it as a
string. It seems the behaviour changes depending on whether a literal
string or jinja template is used.
The following simple example illustrates the difference (see output of
debug1 and debug2).
Does anyone know how to get debug1 to render output like debug2 but from a
jinja template?
*Playbook:*
tasks:
- name: debug1
debug:
msg: "[1,{{ 2 }}]"
- name: debug2
debug:
msg: "[1,2]"
*Output:*
TASK [debug1]
******************************************************************
ok: [127.0.0.1] => {
"msg": [
1,
2
]
}
TASK [debug2]
******************************************************************
ok: [127.0.0.1] => {
"msg": "[1,2]"
}
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7ecb96be-2fd0-42ae-b9fe-dc8f9a4456fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.