38 lines
869 B
Django/Jinja
38 lines
869 B
Django/Jinja
[Match]
|
|
Name={{ item.value.interface }}
|
|
|
|
{% if item.value.address is defined %}
|
|
[Address]
|
|
{% set addr_cidr = (item.value.address | string + '/' + item.value.netmask | string) | ipaddr('prefix') %}
|
|
Address={{ item.value.address }}/{{ addr_cidr }}
|
|
{% else %}
|
|
[DHCP]
|
|
UseDNS=yes
|
|
UseNTP=yes
|
|
RouteMetric=20
|
|
{% endif %}
|
|
|
|
{% for route in item.value.static_routes | default([]) %}
|
|
[Route]
|
|
Source={{ route['cidr'] }}
|
|
Gateway={{ route['gateway'] }}
|
|
|
|
{% endfor %}
|
|
|
|
[Network]
|
|
{% if item.value.address is defined %}
|
|
{% set addr_cidr = (item.value.address | string + '/' + item.value.netmask | string) | ipaddr('prefix') %}
|
|
Address={{ item.value.address }}/{{ addr_cidr }}
|
|
{% else %}
|
|
DHCP=yes
|
|
{% endif %}
|
|
{% if item.value.gateway is defined %}
|
|
Gateway={{ item.value.gateway }}
|
|
{% endif %}
|
|
|
|
[Link]
|
|
{% if item.value.mtu is defined %}
|
|
MTUBytes={{ item.value.mtu }}
|
|
{% endif %}
|
|
ARP=yes
|