From 839cc5542489125abd723e0296e2bdc837a9d3bf Mon Sep 17 00:00:00 2001 From: "Ben D." Date: Tue, 31 Mar 2026 14:14:05 -0700 Subject: [PATCH] Add playbooks/xcp_xo_snapshot_cleanup.yml --- playbooks/xcp_xo_snapshot_cleanup.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 playbooks/xcp_xo_snapshot_cleanup.yml diff --git a/playbooks/xcp_xo_snapshot_cleanup.yml b/playbooks/xcp_xo_snapshot_cleanup.yml new file mode 100644 index 0000000..8210673 --- /dev/null +++ b/playbooks/xcp_xo_snapshot_cleanup.yml @@ -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. \ No newline at end of file