feat(network): make interfaces[] canonical, normalize flat fields as AWX compat

This commit is contained in:
2026-02-12 22:17:02 +01:00
parent 5108e46a4c
commit 66057bc9b2
17 changed files with 222 additions and 159 deletions

View File

@@ -1,24 +1,26 @@
[connection]
id=LAN
id=LAN-{{ idx }}
uuid={{ configuration_net_uuid }}
type=ethernet
interface-name={{ configuration_iface_name }}
[ipv4]
{% set iface = configuration_iface %}
{% set dns_list = system_cfg.network.dns.servers | default([]) %}
{% set search_list = system_cfg.network.dns.search | default([]) %}
{% if system_cfg.network.ip is defined and system_cfg.network.ip | string | length %}
address1={{ system_cfg.network.ip }}/{{ system_cfg.network.prefix }}{{ (',' ~ system_cfg.network.gateway) if (system_cfg.network.gateway is defined and system_cfg.network.gateway | string | length) else '' }}
{% if iface.ip | default('') | string | length %}
address1={{ iface.ip }}/{{ iface.prefix }}{{ (',' ~ iface.gateway) if (iface.gateway | default('') | string | length) else '' }}
method=manual
{% else %}
method=auto
{% endif %}
{% if dns_list %}
{% if idx | int == 0 and dns_list %}
dns={{ dns_list | join(';') }}
{% endif %}
{% if dns_list %}
{% if idx | int == 0 and dns_list %}
ignore-auto-dns=true
{% endif %}
{% if search_list %}
{% if idx | int == 0 and search_list %}
dns-search={{ search_list | join(';') }}
{% endif %}