network/roles/fabric/templates/loopback.intf.j2

20 lines
697 B
Django/Jinja

{% set addrs = interfaces | selectattr('name', '==', 'lo') |
map(attribute='ip_addresses') | first | selectattr('role') %}
{% set loopback = addrs | selectattr('role.value', '==', 'loopback') |
map(attribute='address') %}
{% set anycast = addrs | selectattr('role.value', '==', 'anycast') |
map(attribute='address') %}
auto lo
iface lo inet loopback
{% for address in loopback %}
address {{ address }}
{% endfor %}
{% if peer is defined %}
{% if loopback | ipv4 %}
vxlan-local-tunnelip {{ loopback | ipv4 | first | ipaddr('address') }}
{% endif %}
{% if anycast | ipv4 %}
clagd-vxlan-anycast-ip {{ anycast | first | ipaddr('address') }}
{% endif %}
{% endif %}