Jinja template:
{% if grains['os'] == 'Fedora' %}
mailq_path = /usr/bin/mailq.postfix
{% elif grains['os'] == 'Arch' %}
mailq_path = /usr/bin/mailq
{% endif %}
Salt output:
mailq_path = /usr/bin/mailq.postfix
+
Thanks, my mistake! Closing this. For anyone else reading this, the fix is this:
{% if grains['os'] == 'Fedora' -%}
mailq_path = /usr/bin/mailq.postfix
{% elif grains['os'] == 'Arch' -%}
mailq_path = /usr/bin/mailq
{-% endif %}
Thanks for the info. this came up high in google looking for ideas for salt templating.
Please note that @czee actually has it incorrect. To save others, this is how it should look:
{% if grains['os'] == 'Fedora' -%}
mailq_path = /usr/bin/mailq.postfix
{% elif grains['os'] == 'Arch' -%}
mailq_path = /usr/bin/mailq
{%- endif %}
Notice the dash to the right of the percentage sign in the endif line.
How to include same Jinja2 template with ansible. Can anyone help me?
hey @kumaran85 ,
You need to use Ansible's template module. And I believe the question should be asked on Ansible forums or GitHub page.
Most helpful comment
Thanks for the info. this came up high in google looking for ideas for salt templating.
Please note that @czee actually has it incorrect. To save others, this is how it should look:
Notice the dash to the right of the percentage sign in the endif line.