2024-06-24 22:40:13 +00:00
|
|
|
auto lo
|
|
|
|
iface lo inet loopback
|
|
|
|
|
|
|
|
{% for iface in interfaces | selectattr('enabled') %}
|
|
|
|
auto {{ iface.name }}
|
|
|
|
iface {{ iface.name }} inet static
|
|
|
|
{% for ip in iface.ip_addresses %}
|
|
|
|
address {{ ip.address }}
|
|
|
|
{% set subnet = ip.address | ipaddr('subnet') %}
|
|
|
|
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
|
|
|
|
{% set gateway = prefix.custom_fields.gateway.address %}
|
2024-08-06 13:47:05 +00:00
|
|
|
{% if gateway is defined and gateway != ip.address %}
|
2024-06-24 22:40:13 +00:00
|
|
|
gateway {{ gateway | ipaddr('address') }}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% endfor %}
|