Is it possible to ignore variable substitution in templates? I’ve attempted {% raw %}, {% verbatim %}, slash escaping, and using jinja to output braces.
Reason: I am writing a playbook that generates playbooks; so need to preserve the curly braces. Here’s an example:
<mytemplate.j2>
you can add an override header (small notice on template docs that is on my
list to expand)
make this the first line of the template:
#jinja2: variable_start_string: "[%" , variable_end_string: "%]"
then you can use [% var %] on the 'outer' template and {{ var }} won't get
touched in the 'inner' template.
Brian,
Thanks for the workaround! I saw mention of this && didn’t think to apply. Do you think supporting {% raw %} is worthwhile? I can open a ticket if so.
raw is standard Jinja2, we didn’t do anything to disable it.
Brian,
I have tried this workaround. Unfortunately curly braces STILL get evaluated. E.g. in the following template
<mytemplate.j2>
#jinja2: variable_start_string: “[%” , variable_end_string: “%]”
Thanks for the ticket. It’s in queue!