Answer the question
In order to leave comments, you need to log in
How to add \n in jinja2?
There is a code like this on Jinja
{% if item.vlans is defined and item.vlans != None %}{% for vlan in item.vlans %}vlan {{ vlan }} media ethernet state active {%- endfor %}{%- endif %}
but it sculpts everything in one line. What can be done to add \n ? And then if you explicitly write \n at the end, then it writes it so directly. MB is there any official word?
Answer the question
In order to leave comments, you need to log in
You just need not to write the template in one line and remove the minus sign
{% if item.vlans is defined and item.vlans != None %}{% for vlan in item.vlans %}
vlan {{ vlan }} media ethernet state active
{% endfor %}{% endif %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question