2022-01-01 19:24:52 +01:00
|
|
|
# {{ansible_managed}}
|
|
|
|
network:
|
|
|
|
version: 2
|
|
|
|
renderer: networkd
|
|
|
|
ethernets:
|
2022-04-13 19:23:12 +02:00
|
|
|
{{ ansible_default_ipv4.interface }}:
|
2022-01-01 19:24:52 +01:00
|
|
|
dhcp4: true
|
2022-02-05 19:10:11 +01:00
|
|
|
dhcp-identifier: mac
|
2022-01-01 19:24:52 +01:00
|
|
|
dhcp4-overrides:
|
|
|
|
use-routes: false
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if netplan.default_gateway is defined and netplan.default_gateway|length > 0 %}
|
2022-04-16 19:09:47 +02:00
|
|
|
gateway4: {{netplan.default_gateway}}
|
|
|
|
{% endif %}
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if netplan.additionalinterfaces is defined and netplan.additionalinterfaces|length > 0 %}
|
|
|
|
{%- for interface in netplan.additionalinterfaces %}
|
2022-04-16 19:09:47 +02:00
|
|
|
{{ interface.name }}:
|
|
|
|
dhcp4: {{ interface.dhcp4 }}
|
|
|
|
dhcp6: {{ interface.dhcp6 }}
|
|
|
|
dhcp-identifier: mac
|
|
|
|
dhcp4-overrides:
|
|
|
|
use-routes: false
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if interface.addresses is defined and interface.addresses|length > 0 %}
|
2022-04-16 19:09:47 +02:00
|
|
|
addresses:
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- for address in interface.addresses %}
|
2022-04-16 19:09:47 +02:00
|
|
|
- {{address}}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if interface.gateway4 is defined and interface.gateway4|length > 0 %}
|
2022-04-16 19:09:47 +02:00
|
|
|
gateway4: {{interface.gateway4}}
|
|
|
|
{% endif %}
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if interface.gateway6 is defined and interface.gateway6|length > 0 %}
|
2022-04-16 19:09:47 +02:00
|
|
|
gateway4: {{interface.gateway6}}
|
|
|
|
{% endif %}
|
2022-04-16 19:50:17 +02:00
|
|
|
{%- if interface.denydns %}
|
2022-04-16 19:09:47 +02:00
|
|
|
nameservers:
|
|
|
|
addresses: []
|
|
|
|
search: []
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2022-04-16 19:32:19 +02:00
|
|
|
{% endif %}
|