Getting some good progress with building OS CX configs,
I wanted to see if anyone knows how I can test if a variable is present.
I have an if statement in a template to check if something is defined.
#--interfaces.j2--#
{% if item.lag is defined and item.lag|length >0 %}
lag {{ item.lag }}
{% endif %}
#--host_vars--#
physical_links:
- { port: 1/1/1, enabled: 'yes', mtu: 9000, lag: , peer: CoreCX, udld: 'no', rg: 'no',}
but the output either fails, or is considered to have something in it.
I've tried a few items but no success
{% if item.lag is defined and is not null %}
Any ideas?