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 17
17
uri : " {{ libvirt_vm_uri | default(omit, true) }}"
18
18
become : yes
19
19
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.
20
25
- 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 }}
25
33
become : yes
34
+ changed_when : true
26
35
when : vm.name in result.list_vms
Original file line number Diff line number Diff line change 52
52
when : (vm.state | default('present', true)) == 'present'
53
53
54
54
- include_tasks : destroy-vm.yml
55
+ vars :
56
+ boot_firmware : " {{ vm.boot_firmware | default('bios', true) | lower }}"
55
57
with_items : " {{ libvirt_vms }}"
56
58
loop_control :
57
59
loop_var : vm
You can’t perform that action at this time.
0 commit comments