File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1717 uri : " {{ libvirt_vm_uri | default(omit, true) }}"
1818 become : yes
1919
20+ # note(wszumski): the virt module does not seem to support
21+ # removing vms with nvram defined - as a workaround, use the
22+ # virsh cli directly. It may be better to detect if dumpxml
23+ # actually contains an nvram element rather than relying on
24+ # boot_firmware having the correct value.
2025 - name : Ensure the VM is undefined
21- virt :
22- name : " {{ vm.name }}"
23- command : undefine
24- uri : " {{ libvirt_vm_uri | default(omit, true) }}"
26+ command :
27+ cmd : >-
28+ virsh
29+ {% if libvirt_vm_uri %}-c {{ libvirt_vm_uri }}{% endif %}
30+ undefine
31+ {% if boot_firmware == 'efi' %} --nvram{% endif %}
32+ {{ vm.name }}
2533 become : yes
34+ changed_when : true
2635 when : vm.name in result.list_vms
Original file line number Diff line number Diff line change 5252 when : (vm.state | default('present', true)) == 'present'
5353
5454- include_tasks : destroy-vm.yml
55+ vars :
56+ boot_firmware : " {{ vm.boot_firmware | default('bios', true) | lower }}"
5557 with_items : " {{ libvirt_vms }}"
5658 loop_control :
5759 loop_var : vm
You can’t perform that action at this time.
0 commit comments