1
0

fixes to vm_destroy

This commit is contained in:
michael 2022-10-30 23:57:26 +13:00
parent 50c451e94d
commit 2093fca5d2
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,5 @@
--- ---
- name: create the vms - name: destroy the vms
hosts: hv00 hosts: hv00
gather_facts: true gather_facts: true
become: true become: true

View File

@ -21,16 +21,26 @@
when: vm_name in vm_list.list_vms when: vm_name in vm_list.list_vms
block: block:
- name: stop the vm - name: shutdown the vm
community.libvirt.virt: community.libvirt.virt:
state: shutdown state: shutdown
name: "{{ vm_name }}" name: "{{ vm_name }}"
- name: destroy the vm # - name: destroy the vm
# community.libvirt.virt:
# state: destroyed
# name: "{{ vm_name }}"
- name: undefine the vm
community.libvirt.virt: community.libvirt.virt:
state: destroyed state: undefine
name: "{{ vm_name }}" name: "{{ vm_name }}"
- name: delete the firmware vars file
ansible.builtin.file:
path: "{{ firmware_vhd_pool_dir }}/{{ vm_name }}_VARS.fd"
state: absent
- name: delete the root vhd - name: delete the root vhd
when: delete_root_vhd when: delete_root_vhd
ansible.builtin.file: ansible.builtin.file: