diff --git a/roles/cleanup/tasks/libvirt.yml b/roles/cleanup/tasks/libvirt.yml index bbe4ec5..f447a02 100644 --- a/roles/cleanup/tasks/libvirt.yml +++ b/roles/cleanup/tasks/libvirt.yml @@ -99,6 +99,7 @@ name: "{{ hostname }}" state: running + # delegate_to inventory_hostname: overrides play-level localhost to run wait_for_connection against the VM - name: Wait for VM to boot up delegate_to: "{{ inventory_hostname }}" ansible.builtin.wait_for_connection: diff --git a/roles/cleanup/tasks/vmware.yml b/roles/cleanup/tasks/vmware.yml index 70217d0..758f479 100644 --- a/roles/cleanup/tasks/vmware.yml +++ b/roles/cleanup/tasks/vmware.yml @@ -12,19 +12,33 @@ validate_certs: "{{ hypervisor_cfg.certs | bool }}" datacenter: "{{ hypervisor_cfg.datacenter }}" name: "{{ hostname }}" - cdrom: - - controller_number: 0 - unit_number: 0 - controller_type: sata - type: iso - iso_path: "{{ boot_iso }}" - state: absent - - controller_number: 0 - unit_number: 1 - controller_type: sata - type: iso - iso_path: "{{ rhel_iso if rhel_iso is defined and rhel_iso | length > 0 else omit }}" - state: absent + cdrom: >- + {{ + [ + { + 'controller_number': 0, + 'unit_number': 0, + 'controller_type': 'sata', + 'type': 'iso', + 'iso_path': boot_iso, + 'state': 'absent' + } + ] + + ( + [ + { + 'controller_number': 0, + 'unit_number': 1, + 'controller_type': 'sata', + 'type': 'iso', + 'iso_path': rhel_iso, + 'state': 'absent' + } + ] + if rhel_iso is defined and rhel_iso | length > 0 + else [] + ) + }} failed_when: false no_log: true diff --git a/roles/cleanup/tasks/xen.yml b/roles/cleanup/tasks/xen.yml index 5f7db5b..edf1e13 100644 --- a/roles/cleanup/tasks/xen.yml +++ b/roles/cleanup/tasks/xen.yml @@ -3,6 +3,8 @@ when: hypervisor_type == "xen" delegate_to: localhost become: false + vars: + xen_installer_media_enabled: "{{ xen_installer_media_enabled | default(false) }}" block: - name: Ensure Xen disk definitions exist when: virtualization_xen_disks is not defined