Add playbooks/xcp_xo_snapshot_cleanup.yml

This commit is contained in:
2026-03-31 14:14:05 -07:00
parent 2f0a557e98
commit 839cc55424

View File

@@ -0,0 +1,20 @@
---
- name: Cleanup Old Snapshots via Xen Orchestra
hosts: localhost
gather_facts: false
vars:
retention_days: 7
tasks:
- name: Find and delete snapshots older than {{ retention_days }} days
# Note: As of current community modules, specific snapshot cleanup
# by date often requires a URI module call to the XO REST API
# or a loop over vm_info results.
community.general.xen_orchestra_vm_info:
api_url: "{{ xo_host }}"
api_user: "{{ xo_user }}"
api_password: "{{ xo_password }}"
register: all_vms
# Logic here would involve filtering all_vms.vms for snapshots
# and comparing 'snapshot_time' against retention_days.