1
0
IaC/ansible/playbooks/templates/ethernet.network.j2

73 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-08-09 08:37:28 -04:00
[Match]
MACAddress={{ item.mac_address }}
[Link]
2023-08-10 07:29:39 -04:00
ARP={{ item.arp | default(true) }}
2023-08-09 08:37:28 -04:00
[Network]
DHCP={{ item.dhcp | default(true) }}
2023-08-10 07:29:39 -04:00
LinkLocalAddressing=False
LLDP={{ item.lldp | default(true) }}
{% if item.nameserver is defined and item.nameserver.ipv4 is defined -%}
{% for nameserver in item.nameserver.ipv4 -%}
DNS={{ nameserver }}
{% endfor -%}
{% endif -%}
{% if item.nameserver is defined and item.nameserver.ipv6 is defined -%}
{% for nameserver in item.nameserver.ipv6 -%}
DNS={{ nameserver }}
{% endfor -%}
{% endif -%}
{% if item.bond is defined -%}
2023-08-09 08:37:28 -04:00
Bond={{ item.bond }}
2023-08-10 07:29:39 -04:00
{% endif -%}
{% if item.bridge is defined -%}
Bridge={{ item.bridge.name }}
{% endif -%}
{% if item.vlans is defined -%}
{% for vlan in item.vlans -%}
2023-08-09 08:37:28 -04:00
VLAN={{ vlan }}
2023-08-10 07:29:39 -04:00
{% endfor -%}
{% endif -%}
{% if item.address is defined %}
[Address]
{% 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 -%}
{% endif -%}
{% endif -%}
{% if item.gateway is defined and 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 is defined and item.gateway.ipv6 is defined %}
[Route]
Destination=::/0
Gateway={{ item.gateway.ipv6 }}
Protocol=static
Type=unicast
{% endif -%}
{% if item.bridge is defined and item.bridge.vlans is defined %}
[BridgeVLANs]
{% for vlan in item.bridge.vlans -%}
VLAN={{ vlan }}
{% endfor -%}
{% if item.bridge.pvid is defined -%}
PVID={{ item.bridge.pvid }}
EgressUntagged={{ item.bridge.pvid }}
{% endif -%}
{% endif -%}