Compare commits
2 commits
bc93f26a21
...
0ed4973894
Author | SHA1 | Date | |
---|---|---|---|
0ed4973894 | |||
9c35f0fa25 |
3 changed files with 14 additions and 8 deletions
|
@ -68,8 +68,10 @@ interface {{ iface.name }}
|
||||||
{# store management address and gateway for later #}
|
{# store management address and gateway for later #}
|
||||||
{%- if iface.mgmt_only and iface.ip_addresses %}
|
{%- if iface.mgmt_only and iface.ip_addresses %}
|
||||||
{% set mgmt.ip = iface.ip_addresses[0].address %}
|
{% set mgmt.ip = iface.ip_addresses[0].address %}
|
||||||
{% if iface.custom_fields.gateway %}
|
{% set subnet = mgmt.ip | ipaddr('subnet') %}
|
||||||
{% set mgmt.gw = iface.custom_fields.gateway.address %}
|
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
|
||||||
|
{% if prefix.custom_fields.gateway %}
|
||||||
|
{% set mgmt.gw = prefix.custom_fields.gateway.address %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,10 @@ interface {{ iface.name }}
|
||||||
{% if iface.ip_addresses %}
|
{% if iface.ip_addresses %}
|
||||||
{% set address = iface.ip_addresses | map(attribute='address') | first %}
|
{% set address = iface.ip_addresses | map(attribute='address') | first %}
|
||||||
ip address {{ address | ipaddr('address') }} {{ address | ipaddr('netmask') }}
|
ip address {{ address | ipaddr('address') }} {{ address | ipaddr('netmask') }}
|
||||||
{% if iface.custom_fields.gateway %}
|
{% set subnet = address | ipaddr('subnet') %}
|
||||||
gateway {{ iface.custom_fields.gateway.address | ipaddr('address') }}
|
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
|
||||||
|
{% if prefix.custom_fields.gateway %}
|
||||||
|
gateway {{ prefix.custom_fields.gateway.address | ipaddr('address') }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
|
|
@ -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 %}
|
||||||
|
|
Loading…
Reference in a new issue