added new playbooks and tasks
This commit is contained in:
11
roles/proxmox-automation/tasks/create-snapshots.yaml
Normal file
11
roles/proxmox-automation/tasks/create-snapshots.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
- name: Create new snapshot and keep only the 2 newest snapshots
|
||||
community.proxmox.proxmox_snap:
|
||||
api_host: "{{ proxmox_host }}"
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_token_id: "{{ proxmox_token_id }}"
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
vmid: "{{ vmid }}"
|
||||
state: present
|
||||
snapname: "{{ snapshot_name | default('before_update') }}"
|
||||
retention: 2
|
||||
delegate_to: localhost
|
||||
10
roles/proxmox-automation/tasks/delete-snapshots.yaml
Normal file
10
roles/proxmox-automation/tasks/delete-snapshots.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
- name: Delete snapshot before_major
|
||||
community.proxmox.proxmox_snap:
|
||||
api_host: "{{ proxmox_host }}"
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_token_id: "{{ proxmox_token_id }}"
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
vmid: "{{ vmid }}"
|
||||
state: absent
|
||||
snapname: before_major
|
||||
delegate_to: localhost
|
||||
15
roles/proxmox-automation/tasks/get-vmid.yaml
Normal file
15
roles/proxmox-automation/tasks/get-vmid.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
- name: Retrieve information about specific VM by name and get current configuration
|
||||
community.proxmox.proxmox_vm_info:
|
||||
api_host: "{{ proxmox_host }}"
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_token_id: "{{ proxmox_token_id }}"
|
||||
api_token_secret: "{{ proxmox_token_secret }}"
|
||||
type: all
|
||||
name: "{{ inventory_hostname }}"
|
||||
config: current
|
||||
register: vm_info
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Extract VMID
|
||||
ansible.builtin.set_fact:
|
||||
vmid: "{{ vm_info.proxmox_vms[0].vmid }}"
|
||||
Reference in New Issue
Block a user