2022-08-31 17:39:41 +00:00
|
|
|
---
|
|
|
|
network:
|
2024-04-14 22:23:27 +00:00
|
|
|
version: {{ network_netplan_version | default(2) }}
|
|
|
|
renderer: {{ network_netplan_renderer | default('networkd') }}
|
2022-08-31 17:39:41 +00:00
|
|
|
{% if network_interfaces is defined and network_interfaces | length %}
|
|
|
|
ethernets:
|
|
|
|
{% for iface in network_interfaces %}
|
|
|
|
{{ iface['name'] }}:
|
|
|
|
{% if iface['inet4']['dhcp'] is defined %}
|
2024-04-14 22:23:27 +00:00
|
|
|
dhcp4: {{ iface['inet4']['dhcp'] | ternary('true', 'false') }}
|
2022-08-31 17:39:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if iface['inet4']['dhcp'] is defined %}
|
2024-04-14 22:23:27 +00:00
|
|
|
dhcp6: {{ iface['inet6']['dhcp'] | ternary('true', 'false') }}
|
|
|
|
{% endif %}
|
|
|
|
{% if iface['inet6']['accept_ra'] is defined %}
|
|
|
|
accept-ra: {{ iface['inet6']['accept_ra'] | ternary('true', 'false') }}
|
2022-08-31 17:39:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if iface['inet4']['address'] is defined or iface['inet6']['address'] is defined %}
|
|
|
|
addresses:
|
|
|
|
{% for ip in iface['inet4']['address'] | default([]) %}
|
|
|
|
- {{ ip }}
|
|
|
|
{% endfor %}
|
|
|
|
{% for ip in iface['inet6']['address'] | default([]) %}
|
|
|
|
- {{ ip }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% if iface['inet4']['gateway'] is defined %}
|
2024-04-14 22:23:27 +00:00
|
|
|
gateway4: {{ iface['inet4']['gateway'] }}
|
2022-08-31 17:39:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if iface['inet6']['gateway'] is defined %}
|
2024-04-14 22:23:27 +00:00
|
|
|
gateway6: {{ iface['inet6']['gateway'] }}
|
2022-08-31 17:39:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if network_dns_nameservers is defined %}
|
|
|
|
nameservers:
|
|
|
|
addresses:
|
|
|
|
{% for ip in network_dns_nameservers %}
|
|
|
|
- {{ ip }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|