--- network: version: {{ network_netplan_version | default(2) }} renderer: {{ network_netplan_renderer | default('networkd') }} {% if network_interfaces is defined and network_interfaces | length %} ethernets: {% for iface in network_interfaces %} {{ iface['name'] }}: {% if iface['inet4']['dhcp'] is defined %} dhcp4: {{ iface['inet4']['dhcp'] | ternary('true', 'false') }} {% endif %} {% if iface['inet4']['dhcp'] is defined %} dhcp6: {{ iface['inet6']['dhcp'] | ternary('true', 'false') }} {% endif %} {% if iface['inet6']['accept_ra'] is defined %} accept-ra: {{ iface['inet6']['accept_ra'] | ternary('true', 'false') }} {% 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 %} gateway4: {{ iface['inet4']['gateway'] }} {% endif %} {% if iface['inet6']['gateway'] is defined %} gateway6: {{ iface['inet6']['gateway'] }} {% endif %} {% if network_dns_nameservers is defined %} nameservers: addresses: {% for ip in network_dns_nameservers %} - {{ ip }} {% endfor %} {% endif %} {% endfor %} {% endif %}