refactor(bootstrap): nest network fields under system.network to match main project schema

This commit is contained in:
2026-02-11 23:01:39 +01:00
parent 45c002c2dd
commit a60e6fd0d3
19 changed files with 185 additions and 175 deletions

View File

@@ -8,12 +8,12 @@
ansible.builtin.assert:
that:
- system is mapping
- system.dns is not defined or system.dns is mapping
- system.network is not defined or system.network is mapping
- system.user is not defined or system.user is mapping
- system.root is not defined or system.root is mapping
- system.luks is not defined or system.luks is mapping
- system.features is not defined or system.features is mapping
fail_msg: "system and its nested keys (dns, user, root, luks, features) must be dictionaries."
fail_msg: "system and its nested keys (network, user, root, luks, features) must be dictionaries."
quiet: true
- name: Validate system features input types
@@ -57,39 +57,40 @@
cpus: "{{ [system_raw.cpus | default(0) | int, 0] | max }}"
memory: "{{ [system_raw.memory | default(0) | int, 0] | max }}"
balloon: "{{ [system_raw.balloon | default(0) | int, 0] | max }}"
network: "{{ system_raw.network | default('') | string }}"
vlan: "{{ system_raw.vlan | default('') | string }}"
ip: "{{ system_raw.ip | default('') | string }}"
prefix: >-
{{
(system_raw.prefix | int)
if (system_raw.prefix | default('') | string | length) > 0
else ''
}}
gateway: "{{ system_raw.gateway | default('') | string }}"
dns:
servers: >-
network:
bridge: "{{ system_raw.network.bridge | default('') | string }}"
vlan: "{{ system_raw.network.vlan | default('') | string }}"
ip: "{{ system_raw.network.ip | default('') | string }}"
prefix: >-
{{
(
system_raw.dns.servers
if system_raw.dns.servers is iterable and system_raw.dns.servers is not string
else (system_raw.dns.servers | string).split(',')
)
| map('trim')
| reject('equalto', '')
| list
}}
search: >-
{{
(
system_raw.dns.search
if system_raw.dns.search is iterable and system_raw.dns.search is not string
else (system_raw.dns.search | string).split(',')
)
| map('trim')
| reject('equalto', '')
| list
(system_raw.network.prefix | int)
if (system_raw.network.prefix | default('') | string | length) > 0
else ''
}}
gateway: "{{ system_raw.network.gateway | default('') | string }}"
dns:
servers: >-
{{
(
system_raw.network.dns.servers
if system_raw.network.dns.servers is iterable and system_raw.network.dns.servers is not string
else (system_raw.network.dns.servers | string).split(',')
)
| map('trim')
| reject('equalto', '')
| list
}}
search: >-
{{
(
system_raw.network.dns.search
if system_raw.network.dns.search is iterable and system_raw.network.dns.search is not string
else (system_raw.network.dns.search | string).split(',')
)
| map('trim')
| reject('equalto', '')
| list
}}
path: "{{ system_raw.path | default('') | string }}"
packages: >-
{{

View File

@@ -50,7 +50,7 @@
- name: Validate nested system mappings
loop:
- dns
- network
- user
- root
- luks
@@ -65,7 +65,7 @@
- name: Validate system sub-dict schemas
loop:
- dns
- network
- user
- root
- luks
@@ -171,8 +171,8 @@
- hypervisor_cfg.host | string | length > 0
- hypervisor_cfg.storage | string | length > 0
- system_cfg.id | string | length > 0
- system_cfg.network | string | length > 0
fail_msg: "Missing required Proxmox inputs. Define hypervisor.(url,username,password,host,storage) and system.(id,network)."
- system_cfg.network.bridge | string | length > 0
fail_msg: "Missing required Proxmox inputs. Define hypervisor.(url,username,password,host,storage), system.id, and system.network.bridge."
quiet: true
- name: Validate VMware hypervisor inputs
@@ -187,8 +187,8 @@
- hypervisor_cfg.datacenter | string | length > 0
- hypervisor_cfg.cluster | string | length > 0
- hypervisor_cfg.storage | string | length > 0
- system_cfg.network | string | length > 0
fail_msg: "Missing required VMware inputs. Define hypervisor.(url,username,password,datacenter,cluster,storage) and system.network."
- system_cfg.network.bridge | string | length > 0
fail_msg: "Missing required VMware inputs. Define hypervisor.(url,username,password,datacenter,cluster,storage) and system.network.bridge."
quiet: true
- name: Validate Xen hypervisor inputs
@@ -197,8 +197,8 @@
- hypervisor_type == "xen"
ansible.builtin.assert:
that:
- system_cfg.network | string | length > 0
fail_msg: "Missing required Xen inputs. Define system.network."
- system_cfg.network.bridge | string | length > 0
fail_msg: "Missing required Xen inputs. Define system.network.bridge."
quiet: true
- name: Validate virtual installer ISO requirement
@@ -322,10 +322,10 @@
label: "{{ item | to_json }}"
- name: Validate static IP requirements
when: system_cfg.ip is defined and (system_cfg.ip | string | length) > 0
when: system_cfg.network.ip is defined and (system_cfg.network.ip | string | length) > 0
ansible.builtin.assert:
that:
- system_cfg.prefix is defined
- (system_cfg.prefix | int) > 0
fail_msg: "system.prefix is required when system.ip is set."
- system_cfg.network.prefix is defined
- (system_cfg.network.prefix | int) > 0
fail_msg: "system.network.prefix is required when system.network.ip is set."
quiet: true