1
0
IaC/ansible/roles/systemd_networkd/templates/vlan.network.j2

51 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2023-08-09 08:37:28 -04:00
[Match]
2023-08-10 07:29:39 -04:00
Name={{ item.name | regex_replace('^[0-9]*-', '') | regex_replace('\.network', '') }}
2023-08-09 08:37:28 -04:00
[Link]
2023-08-10 07:29:39 -04:00
ARP={{ item.arp | default(true) }}
2023-08-09 08:37:28 -04:00
[Network]
2023-08-10 07:29:39 -04:00
DHCP={{ item.dhcp | default(true) }}
LinkLocalAddressing=False
LLDP={{ item.lldp | default(true) }}
{% if item.nameserver is defined and item.nameserver.ipv4 is defined -%}
2023-08-09 08:55:51 -04:00
{% for nameserver in item.nameserver.ipv4 -%}
2023-08-09 08:37:28 -04:00
DNS={{ nameserver }}
2023-08-09 08:55:51 -04:00
{% endfor -%}
{% endif -%}
2023-08-10 07:29:39 -04:00
{% if item.nameserver is defined and item.nameserver.ipv6 is defined -%}
2023-08-09 08:55:51 -04:00
{% for nameserver in item.nameserver.ipv6 -%}
2023-08-09 08:37:28 -04:00
DNS={{ nameserver }}
2023-08-09 08:55:51 -04:00
{% endfor -%}
{% endif -%}
2023-08-09 08:37:28 -04:00
2023-08-10 07:29:39 -04:00
{% if item.address is defined %}
2023-08-09 08:37:28 -04:00
[Address]
2023-08-10 07:29:39 -04:00
{% if item.address.ipv4 is defined -%}
{% for address in item.address.ipv4 -%}
Address={{ address }}
{% endfor -%}
{% endif -%}
{% if item.address.ipv6 is defined -%}
{% for address in item.address.ipv6 -%}
Address={{ address }}
{% endfor -%}
2023-08-09 08:55:51 -04:00
{% endif -%}
{% endif -%}
2023-08-10 07:29:39 -04:00
{% if item.gateway is defined and item.gateway.ipv4 is defined %}
2023-08-09 08:37:28 -04:00
[Route]
Destination=0.0.0.0/0
Gateway={{ item.gateway.ipv4 }}
Scope=global
Protocol=static
Type=unicast
2023-08-09 08:55:51 -04:00
{% endif -%}
2023-08-09 08:37:28 -04:00
2023-08-10 07:29:39 -04:00
{% if item.gateway is defined and item.gateway.ipv6 is defined %}
2023-08-09 08:37:28 -04:00
[Route]
Destination=::/0
2023-08-09 08:55:51 -04:00
Gateway={{ item.gateway.ipv6 }}
2023-08-09 08:37:28 -04:00
Protocol=static
Type=unicast
2023-08-09 08:55:51 -04:00
{% endif -%}