Files
ansible-msp-automations/playbooks/xcp_xo_snapshot_cleanup.yml

20 lines
698 B
YAML

---
- 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.