--- - name: Ensure hypervisor input is a dictionary ansible.builtin.set_fact: hypervisor: "{{ hypervisor | default({}) }}" changed_when: false - name: Validate hypervisor input ansible.builtin.assert: that: - hypervisor is mapping - hypervisor.type is defined - hypervisor.type | string | length > 0 fail_msg: "hypervisor must be a dictionary and hypervisor.type must be set (e.g. libvirt|proxmox|vmware|xen|none)." quiet: true - name: Normalize hypervisor configuration vars: hypervisor_cfg_normalized: "{{ hypervisor_defaults | combine(hypervisor, recursive=True) }}" ansible.builtin.set_fact: hypervisor_cfg: "{{ hypervisor_cfg_normalized }}" hypervisor_type: "{{ hypervisor_cfg_normalized.type | string | lower }}" changed_when: false