Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions ansible/roles/create-vm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
command: list_vms
register: all_vms

- name: find VMs that start with "microshift-*"
set_fact:
vm_match: "{{ all_vms.list_vms | join(' ') | regex_findall('microshift-\\S+', multiline=True, ignorecase=True) }}"

- name: destroy microshift VM
- name: destroy target VM if present
community.libvirt.virt:
name: "{{ item }}"
name: "{{ vm_name }}"
state: destroyed
loop: "{{ vm_match }}"
when: vm_name in (all_vms.list_vms | default([]))

- name: undefine microshift VM
- name: undefine target VM if present
community.libvirt.virt:
name: "{{ item }}"
name: "{{ vm_name }}"
command: undefine
loop: "{{ vm_match }}"
when: vm_name in (all_vms.list_vms | default([]))

- name: find create-vm.sh
ansible.builtin.find:
Expand Down