Files
kayobe/ansible/roles/infra-vms/tasks/destroy.yml
Jack Hodgkiss 0137015e6c infra-vm: efficiently handle hostvars during deploy and destroy
Pass only the required variables from `hostvars` for a given infra vm to
significantly reduce wait time during `kayobe infra vm provision` and
`kayobe infra vm deprovision`. Time to create and destroy a VM now take
a minute or less.

Closes-Bug: #2093255
Change-Id: I15d17f45d15c04aced0a4c0fe97e1d798ff46799
2025-01-10 13:44:40 +00:00

18 lines
463 B
YAML

---
- name: Destroy VMs
import_role:
name: stackhpc.libvirt-vm
vars:
infra_vm_configdrive_volume:
name: "{{ vm_name }}-configdrive"
pool: "{{ vm_pool }}"
libvirt_vms:
- name: "{{ vm_name }}"
boot_firmware: "{{ vm_boot_firmware | default }}"
memory_mb: "{{ vm_memory_mb }}"
vcpus: "{{ vm_vcpus }}"
volumes: "{{ vm_volumes + [infra_vm_configdrive_volume] }}"
state: "absent"
become: True