1
0
IaC/ansible/playbooks/templates/vlan.network.j2
2023-08-09 22:55:51 +10:00

45 lines
886 B
Django/Jinja

[Match]
Name={{ item.name | regex_replace('^[0-9]*-', '') | regex_replace('\.netdev', '') }}
[Link]
ARP={{ item.arp }}
[Network]
{% if item.nameserver.ipv4 is defined -%}
{% for nameserver in item.nameserver.ipv4 -%}
DNS={{ nameserver }}
{% endfor -%}
{% endif -%}
{% if item.nameserver.ipv6 is defined -%}
{% for nameserver in item.nameserver.ipv6 -%}
DNS={{ nameserver }}
{% endfor -%}
{% endif -%}
{% if item.address.ipv4 is defined %}
[Address]
Address={{ item.address.ipv4 }}
{% endif -%}
{% if item.address.ipv6 is defined %}
[Address]
Address={{ item.address.ipv6 }}
{% endif -%}
{% if item.gateway.ipv4 is defined %}
[Route]
Destination=0.0.0.0/0
Gateway={{ item.gateway.ipv4 }}
Scope=global
Protocol=static
Type=unicast
{% endif -%}
{% if item.gateway.ipv6 is defined %}
[Route]
Destination=::/0
Gateway={{ item.gateway.ipv6 }}
Protocol=static
Type=unicast
{% endif -%}