I am trying to create an ansible task which deletes snapshots that i created with another role before our maintenance window.
i can create snapshots with an ansible task as below. I gets variable from a json file for each Container or VM
I could not find any API for this purpose in documentation below.
https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/snapshot/{snapname}
We have many VM/CTs so having a snapshot everytime does not make sense but deleting also manually is a loss of time considering we have multiple clusters.
I wish to automate the task of creation and removal.
The thing is i am not the manager for proxmoxes so a shell access is not possible for me.
What can i do to achieve this using ansible ?
i can create snapshots with an ansible task as below. I gets variable from a json file for each Container or VM
YAML:
- name: Create snapshots for VM/Containers in multiple Proxmox environments
uri:
url: "{{ item.api_url }}/nodes/{{ item.node }}/lxc/{{ item.id }}/snapshot"
method: POST
validate_certs: false
headers:
Authorization: "PVEAPIToken={{ item.api_token_id }}={{ item.api_token_secret }}"
body_format: json
body:
snapname: "{{ SNAPSHOT_NAME }}"
description: "Snapshot created by Ansible"
status_code: 200
loop: "{{ vmct_data }}"
loop_control:
loop_var: item
delegate_to: localhost
register: snapshot_results
I could not find any API for this purpose in documentation below.
https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/snapshot/{snapname}
We have many VM/CTs so having a snapshot everytime does not make sense but deleting also manually is a loss of time considering we have multiple clusters.
I wish to automate the task of creation and removal.
The thing is i am not the manager for proxmoxes so a shell access is not possible for me.
What can i do to achieve this using ansible ?