Stop any running VMs when re-deploying
Stops running VMs when doing a deploy to ensure the VMs start fresh and can reload their config during deploy. Also removes LVs to force a redeploy of the VMs. Change-Id: I7992e25f4e0e103ae66487f2e88a99ca962a9355
This commit is contained in:
parent
cb77f7e3d2
commit
33c3fbdfe7
@ -29,6 +29,24 @@
|
|||||||
- always
|
- always
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Stop running VMs
|
||||||
|
command: "virsh destroy {{ hostvars[item]['server_hostname'] }}"
|
||||||
|
failed_when: false
|
||||||
|
when:
|
||||||
|
- hostvars[item]['server_vm'] | default(false) | bool
|
||||||
|
with_items: "{{ groups['pxe_servers'] }}"
|
||||||
|
|
||||||
|
- name: Delete VM LV
|
||||||
|
lvol:
|
||||||
|
vg: vg01
|
||||||
|
lv: "{{ hostvars[item]['server_hostname'] }}"
|
||||||
|
state: absent
|
||||||
|
force: yes
|
||||||
|
failed_when: false
|
||||||
|
when:
|
||||||
|
- hostvars[item]['server_vm'] | default(false) | bool
|
||||||
|
with_items: "{{ groups['pxe_servers'] }}"
|
||||||
|
|
||||||
- name: Create VM LV
|
- name: Create VM LV
|
||||||
lvol:
|
lvol:
|
||||||
vg: vg01
|
vg: vg01
|
||||||
|
Loading…
x
Reference in New Issue
Block a user