MNAIO: Use file instead of command for disk image clean-up
Rather than use the command module, we use the file module which is idempotent. We also remove the conditional for the clean up so that it's easier to switch between back-ends and still have the clean-up happen. Change-Id: I5d77bbd236d1cb7d45bc4dda4206475b5663b1c0
This commit is contained in:
parent
c64f784c2b
commit
80b4efab8a
@ -45,16 +45,14 @@
|
||||
failed_when: false
|
||||
when:
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
- default_vm_disk_mode | default('lvm') == "lvm"
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
- name: Delete VM Disk Image
|
||||
command: |
|
||||
rm -f /var/lib/libvirt/images/{{ hostvars[item]['server_hostname'] }}.img
|
||||
failed_when: false
|
||||
file:
|
||||
path: "/var/lib/libvirt/images/{{ hostvars[item]['server_hostname'] }}.img"
|
||||
state: absent
|
||||
when:
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
- default_vm_disk_mode | default('lvm') == "file"
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
- name: Create VM LV
|
||||
|
Loading…
x
Reference in New Issue
Block a user