Normalize user-facing defaults
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
block:
|
||||
- name: Set libvirt image paths
|
||||
vars:
|
||||
cleanup_libvirt_image_dir_value: "{{ vm_path | default('/var/lib/libvirt/images') }}"
|
||||
cleanup_libvirt_image_dir_value: >-
|
||||
{{ vm_path if vm_path | length > 0 else '/var/lib/libvirt/images' }}
|
||||
ansible.builtin.set_fact:
|
||||
cleanup_libvirt_image_dir: "{{ cleanup_libvirt_image_dir_value }}"
|
||||
cleanup_libvirt_cloudinit_path: >-
|
||||
@@ -38,7 +39,7 @@
|
||||
changed_when: false
|
||||
|
||||
- name: Remove boot ISO device from VM XML (source match)
|
||||
when: boot_iso is defined and (boot_iso | length > 0)
|
||||
when: boot_iso | length > 0
|
||||
community.general.xml:
|
||||
xmlstring: "{{ cleanup_libvirt_domain_xml }}"
|
||||
xpath: "/domain/devices/disk[contains(source/@file, '{{ boot_iso | basename }}')]"
|
||||
@@ -46,7 +47,7 @@
|
||||
register: cleanup_libvirt_xml_strip_boot_source
|
||||
|
||||
- name: Update cleaned VM XML after removing boot ISO source match
|
||||
when: boot_iso is defined and (boot_iso | length > 0)
|
||||
when: boot_iso | length > 0
|
||||
ansible.builtin.set_fact:
|
||||
cleanup_libvirt_domain_xml: "{{ cleanup_libvirt_xml_strip_boot_source.xmlstring }}"
|
||||
changed_when: false
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
unit_number: 1
|
||||
controller_type: sata
|
||||
type: iso
|
||||
iso_path: "{{ rhel_iso | default(omit) }}"
|
||||
iso_path: "{{ rhel_iso if rhel_iso | length > 0 else omit }}"
|
||||
state: absent
|
||||
failed_when: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user