initial project commit

This commit is contained in:
2022-09-21 19:37:15 -04:00
commit 2c9d85e94a
112 changed files with 2081 additions and 0 deletions

View File

@ -0,0 +1,41 @@
---
- name: Fetch VM status
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_fetch_status
loop : "{{ lab_nodes }}"
loop_control :
label : "{{ item.name }}"
until : r_fetch_status.status == 200 and r_fetch_status.json.data.status is defined
retries : "{{ __api_retries }}"
delay : "{{ __api_polling }}"
- name: Stop VMs
uri:
url : "{{ __pve_endpoint }}/nodes/{{ item.item.vm_host | default(__pve_node) }}/qemu/\
{{ item.item.vmid }}/status/stop"
method : POST
headers :
Content-type : "application/x-www-form-urlencoded"
Authorization : "{{ __pve_token }}"
vmid : "{{ item.item.vmid }}"
return_content : no
validate_certs : no
register : r_stop_vm
loop : "{{ r_fetch_status.results }}"
loop_control :
label : "{{ item.json.data.name }}"
when :
- item.json.data.status == 'running'|lower
...