firewall: get mgmt gateway from custom field on prefix
Mainly so we can add IPv6 mgmt addresses and drop the gateway custom field from NetBox interfaces.
This commit is contained in:
parent
6040a3ae84
commit
2f662373e5
|
@ -18,9 +18,14 @@ iface {{ iface.name }}
|
|||
{% endif %}
|
||||
{% for addr in iface.ip_addresses %}
|
||||
address {{ addr.address }}
|
||||
{% endfor %}
|
||||
{% if iface.custom_fields.gateway %}
|
||||
up ip route add default via {{ iface.custom_fields.gateway.address | ipaddr('address') }}{% if iface.vrf %} vrf {{ iface.vrf.name }}{% endif %}
|
||||
{% set subnet = addr.address | ipaddr('subnet') %}
|
||||
{% set prefix_match = prefixes | selectattr('prefix', '==', subnet) %}
|
||||
{% if prefix_match %}
|
||||
{% set prefix = prefix_match | first %}
|
||||
{% if prefix.custom_fields.gateway %}
|
||||
up ip route add default via {{ prefix.custom_fields.gateway.address | ipaddr('address') }}{% if iface.vrf %} vrf {{ iface.vrf.name }}{% endif %}
|
||||
{% endif %}
|
||||
{% endif +%}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue