MNAIO: Use virt module to shut VM's down when saving images
It's better to shut the VM's down cleanly instead of just turning them off, so we change 'destroy' to 'shutdown' and use the virt module for this action instead of the command module. Change-Id: I896b7794328b91dc59726bf1d5366eeb7112ca21
This commit is contained in:
@@ -37,8 +37,9 @@
|
||||
register: _virt_pools
|
||||
|
||||
- name: Stop running VMs
|
||||
command: "virsh destroy {{ hostvars[item]['server_hostname'] }}"
|
||||
failed_when: false
|
||||
virt:
|
||||
name: "{{ hostvars[item]['server_hostname'] }}"
|
||||
state: shutdown
|
||||
when:
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
Reference in New Issue
Block a user