fix(cleanup): fix vmware CD-ROM omit fragility and add cross-role defaults

This commit is contained in:
2026-02-20 20:19:25 +01:00
parent 9f9a4b38b8
commit a2c19e2e49
3 changed files with 30 additions and 13 deletions

View File

@@ -99,6 +99,7 @@
name: "{{ hostname }}" name: "{{ hostname }}"
state: running 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 - name: Wait for VM to boot up
delegate_to: "{{ inventory_hostname }}" delegate_to: "{{ inventory_hostname }}"
ansible.builtin.wait_for_connection: ansible.builtin.wait_for_connection:

View File

@@ -12,19 +12,33 @@
validate_certs: "{{ hypervisor_cfg.certs | bool }}" validate_certs: "{{ hypervisor_cfg.certs | bool }}"
datacenter: "{{ hypervisor_cfg.datacenter }}" datacenter: "{{ hypervisor_cfg.datacenter }}"
name: "{{ hostname }}" name: "{{ hostname }}"
cdrom: cdrom: >-
- controller_number: 0 {{
unit_number: 0 [
controller_type: sata {
type: iso 'controller_number': 0,
iso_path: "{{ boot_iso }}" 'unit_number': 0,
state: absent 'controller_type': 'sata',
- controller_number: 0 'type': 'iso',
unit_number: 1 'iso_path': boot_iso,
controller_type: sata 'state': 'absent'
type: iso }
iso_path: "{{ rhel_iso if rhel_iso is defined and rhel_iso | length > 0 else omit }}" ]
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 failed_when: false
no_log: true no_log: true

View File

@@ -3,6 +3,8 @@
when: hypervisor_type == "xen" when: hypervisor_type == "xen"
delegate_to: localhost delegate_to: localhost
become: false become: false
vars:
xen_installer_media_enabled: "{{ xen_installer_media_enabled | default(false) }}"
block: block:
- name: Ensure Xen disk definitions exist - name: Ensure Xen disk definitions exist
when: virtualization_xen_disks is not defined when: virtualization_xen_disks is not defined