Hi,

i want to create a template which should result in the following output: 

   1. custommark4 masq 1 PREROUTING inface "${openvpn_if}"


Here, the value "openvpn" should be read from a variable. I have some 
problems with creating proper jinja2-Syntax because of the curly brackets 
which are already there. 
My first solution was just plain 
"${{{ item.name }}_if}" 


which resulted in a parsing error: AnsibleError: ERROR! template error 
while templating string: expected token ':', got '}'"

So i consulted the jinja documentation which specified that i could just 
escape characters with '
The second attempt was: 
"$'{'{{ item.name }}_if}"

This was accepted by jinja, but resulted in "$'{'openvpn_if}" (notice the ' 
around the first curly bracket). This is no valid bash syntax.

So, how could i escape these brackets correctly?


...and for those wondering why i create bash scripts with ansible: I am 
managing a server side firewall with the great FireHOL-utility which is an 
abstraction layer for the iptables-command. And it's config files are using 
plain bash syntax. 

-- 
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/e1992bb0-7613-4542-a8e5-e458a818b991%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to