43 lines
1.5 KiB
YAML

---
- name: Rollback VMs to initial state
uri:
url : "{{ __pve_endpoint }}/nodes/{{ item.vm_host | default(__pve_node) }}/qemu/{{ item.vmid }}/snapshot/{{ __lab_snapshot_name }}/rollback"
method : POST
headers :
Content-type : "application/x-www-form-urlencoded"
Authorization : "{{ __pve_token }}"
body_format : form-urlencoded
body:
node : "{{ item.vm_host | default(__pve_node) }}"
vmid : "{{ item.vmid }}"
snapname : "{{ __lab_snapshot_name }}"
return_content : no
validate_certs : no
register : r_rollback_vms
loop : "{{ lab_nodes }}"
loop_control :
label : "[{{ item.vmid }}] {{ item.name }}"
- name: Wait for rollback completion...
uri:
url : "{{ __pve_endpoint }}/nodes/{{ item.vm_host | default(__pve_node) }}/qemu/\
{{ item.vmid }}/status/current"
method : GET
headers :
Content-type : "application/x-www-form-urlencoded"
Authorization : "{{ __pve_token }}"
vmid : "{{ item.vmid }}"
return_content : no
validate_certs : no
register : r_wait_for_rollback
loop : "{{ lab_nodes }}"
loop_control :
label : "{{ item.name }}"
until : r_wait_for_rollback.status == 200 and r_wait_for_rollback.json.data.status is defined
retries : "{{ __api_retries }}"
delay : "{{ __api_polling }}"
...