refactor(global_defaults): add idempotency guards to normalization tasks
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure hypervisor input is a dictionary
|
- name: Normalize hypervisor configuration
|
||||||
|
when: hypervisor_cfg is not defined
|
||||||
|
block:
|
||||||
|
- name: Ensure hypervisor input is a dictionary
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
hypervisor: "{{ hypervisor | default({}) }}"
|
hypervisor: "{{ hypervisor | default({}) }}"
|
||||||
|
|
||||||
- name: Validate hypervisor input
|
- name: Validate hypervisor input
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- hypervisor is mapping
|
- hypervisor is mapping
|
||||||
@@ -12,7 +15,7 @@
|
|||||||
fail_msg: "hypervisor must be a dictionary and hypervisor.type must be set (e.g. libvirt|proxmox|vmware|xen|none)."
|
fail_msg: "hypervisor must be a dictionary and hypervisor.type must be set (e.g. libvirt|proxmox|vmware|xen|none)."
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
- name: Normalize hypervisor configuration
|
- name: Merge hypervisor defaults with input
|
||||||
vars:
|
vars:
|
||||||
merged: "{{ hypervisor_defaults | combine(hypervisor, recursive=True) }}"
|
merged: "{{ hypervisor_defaults | combine(hypervisor, recursive=True) }}"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: Validate raw system input types
|
- name: Normalize system and disk configuration
|
||||||
|
when: system_cfg is not defined
|
||||||
|
block:
|
||||||
|
- name: Validate raw system input types
|
||||||
ansible.builtin.include_tasks: _validate_input.yml
|
ansible.builtin.include_tasks: _validate_input.yml
|
||||||
|
|
||||||
- name: Normalize system configuration
|
- name: Normalize system configuration
|
||||||
ansible.builtin.include_tasks: _normalize_system.yml
|
ansible.builtin.include_tasks: _normalize_system.yml
|
||||||
|
|
||||||
- name: Normalize disk configuration
|
- name: Normalize disk configuration
|
||||||
ansible.builtin.include_tasks: _normalize_disks.yml
|
ansible.builtin.include_tasks: _normalize_disks.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user