fabric: get mgmt gateway from custom field on prefix

Mainly so we can add IPv6 addresses to mgmt interfaces.
This commit is contained in:
Timotej Lazar 2025-03-23 19:51:25 +01:00
parent bc93f26a21
commit 9c35f0fa25

View file

@ -14,11 +14,13 @@ iface {{ iface.name }}
vrf mgmt vrf mgmt
ip-forward off ip-forward off
ip6-forward off ip6-forward off
{% for ip in iface.ip_addresses | rejectattr('address', 'match', '^fe80::.*/64$' ) %} {% for ip in iface.ip_addresses %}
address {{ ip.address }} address {{ ip.address }}
{% endfor %} {% set subnet = ip.address | ipaddr('subnet') %}
{% if iface.custom_fields.gateway %} {% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
gateway {{ iface.custom_fields.gateway.address | ipaddr('address') }} {% if prefix.custom_fields.gateway %}
gateway {{ prefix.custom_fields.gateway.address | ipaddr('address') }}
{% endif %} {% endif %}
{% endfor %}
{% endfor %} {% endfor %}