access: get mgmt gateway from custom field on prefix
Mainly so we can drop the gateway custom field from NetBox interfaces.
This commit is contained in:
parent
9c35f0fa25
commit
0ed4973894
2 changed files with 8 additions and 4 deletions
|
@ -68,8 +68,10 @@ interface {{ iface.name }}
|
|||
{# store management address and gateway for later #}
|
||||
{%- if iface.mgmt_only and iface.ip_addresses %}
|
||||
{% set mgmt.ip = iface.ip_addresses[0].address %}
|
||||
{% if iface.custom_fields.gateway %}
|
||||
{% set mgmt.gw = iface.custom_fields.gateway.address %}
|
||||
{% set subnet = mgmt.ip | ipaddr('subnet') %}
|
||||
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
|
||||
{% if prefix.custom_fields.gateway %}
|
||||
{% set mgmt.gw = prefix.custom_fields.gateway.address %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue