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

Flat network fields (bridge, ip, prefix, gateway, vlan) are now converted
into a single-entry interfaces[] list during normalization. All virtualization
tasks (proxmox, vmware, libvirt, xen) and configuration (NM, Alpine, Void)
now consume system_cfg.network.interfaces exclusively for multi-NIC support.

Also fixes: user.key -> user.keys in system_cfg output, strict list-only DNS
in example inventories, removes legacy single-MAC virtualization_mac_address
default.
This commit is contained in:
2026-02-12 22:17:02 +01:00
parent d7260a8078
commit 8071a7c56c
17 changed files with 222 additions and 159 deletions

View File

@@ -14,6 +14,17 @@
- name: Create VM in vCenter
delegate_to: localhost
vars:
virtualization_vmware_networks: >-
{%- set ns = namespace(out=[]) -%}
{%- for iface in system_cfg.network.interfaces -%}
{%- set entry = {'name': iface.bridge, 'type': 'dhcp'} -%}
{%- if (iface.vlan | default('') | string | length) > 0 -%}
{%- set entry = entry | combine({'vlan': iface.vlan | int}) -%}
{%- endif -%}
{%- set ns.out = ns.out + [entry] -%}
{%- endfor -%}
{{ ns.out }}
community.vmware.vmware_guest:
hostname: "{{ hypervisor_cfg.url }}"
username: "{{ hypervisor_cfg.username }}"
@@ -53,10 +64,7 @@
"iso_path": rhel_iso
} ] if rhel_iso is defined and rhel_iso | length > 0 else [] )
}}
networks:
- name: "{{ system_cfg.network.bridge }}"
type: dhcp
vlan: "{{ system_cfg.network.vlan if system_cfg.network.vlan is defined and system_cfg.network.vlan | string | length > 0 else omit }}"
networks: "{{ virtualization_vmware_networks }}"
register: virtualization_vmware_create_result
- name: Set VM created fact when VM was powered on during creation