Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔

bovito

🤔
  • SFBA
View GitHub Profile
@bovito
bovito / opt1_template.j2
Created Jul 17, 2018 — forked from halberom/opt1_template.j2
ansible - example of template if else
View opt1_template.j2
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}