Still trying to understand the way to work jinja2 templates…
I’m looking for a way to alter the definition of a gateway address based on the name of the current inventory_hostname.
eth0gateway and eth0gateway_gen are variables in the playbook.
I would like to branch depending on if ecd0 is in, or starts with, the inventory_hostname.
Can someone lead me in the right direction here:
`
{% if {{inventory_hostname}}.find(‘ecd0’) > -1 %}
GATEWAY={{eth0gateway}}
{% else %}
GATEWAY={{eth0gateway_gen}}
{% endif %}
`
Thanks for any tips,
Chris.