blob: 3a677f928ec1bffa07d5be37474b72b2c113b76f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
---
- name: check if vm already exists
delegate_to: "{{ vm_host.name }}"
virt:
name: "{{ inventory_hostname }}"
command: info
register: vmhost_info
- name: remove old vm
when: inventory_hostname in vmhost_info
delegate_to: "{{ vm_host.name }}"
block:
- name: destroy exisiting vm
virt:
name: "{{ inventory_hostname }}"
state: destroyed
- name: wait for vm to be destroyed
wait_for_virt:
name: "{{ inventory_hostname }}"
states: shutdown,crashed
timeout: 5
- name: undefining exisiting vm
virt:
name: "{{ inventory_hostname }}"
command: undefine
|