Skip to content

Jinja

{% if ( (foo == 'foo' or bar == 'bar') and 
        (fooo == 'fooo' or baar == 'baar') ) %}
    <li>some text</li>
{% endif %}

Remove the linebreak

{%- for item in NfsVolumes %}
- name: "{{item.name}}"
    {{item.type}}:
    path: {{item.path}}
    server: {{item.server}}
{%- endfor %}

If else if

{% if "error" in RepoOutput[RepoName.index(repo)] %}
    <td id="error"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% elif "Already" in RepoOutput[RepoName.index(repo) %}
    <td id="good"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% else %}
    <td id="error"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% endif %}
</tr>

{% if grains['os'] == 'Fedora' -%}
mailq_path = /usr/bin/mailq.postfix
{% elif grains['os'] == 'Arch' -%}
mailq_path = /usr/bin/mailq
{-% endif %}