playbooks/pve-storage-pbs.yml: drop the prune-backups policy from the PVE storage entry `pbs` so retention authority lives only in the PBS prune job (prune-pbs). The weekly local PBS-container backup on storage `backup` (keep-last=2) is an intentional exception and left alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012uoq5AVK8mkBgg83Mq6o5V
71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
---
|
|
- name: Remove storage-level PBS prune policy from pbs storage
|
|
hosts: mini-pc
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Read current PBS storage configuration
|
|
ansible.builtin.command:
|
|
argv:
|
|
- pvesh
|
|
- get
|
|
- /storage/pbs
|
|
- --output-format
|
|
- json
|
|
register: pbs_storage_current_raw
|
|
changed_when: false
|
|
no_log: true
|
|
|
|
- name: Parse current PBS storage configuration
|
|
ansible.builtin.set_fact:
|
|
pbs_storage_current: "{{ pbs_storage_current_raw.stdout | from_json }}"
|
|
no_log: true
|
|
|
|
- name: Assert current PBS storage is safe to modify
|
|
ansible.builtin.assert:
|
|
that:
|
|
- pbs_storage_current.storage | default('') == 'pbs'
|
|
- pbs_storage_current.type | default('') == 'pbs'
|
|
- pbs_storage_current.digest | default('') | length > 0
|
|
fail_msg: Refusing to modify /storage/pbs because the returned storage metadata is unexpected or missing a digest.
|
|
no_log: true
|
|
|
|
- name: Remove storage-level prune policy from PBS storage
|
|
ansible.builtin.command:
|
|
argv:
|
|
- pvesh
|
|
- set
|
|
- /storage/pbs
|
|
- --delete
|
|
- prune-backups
|
|
- --digest
|
|
- "{{ pbs_storage_current.digest }}"
|
|
when: pbs_storage_current.get('prune-backups') is not none
|
|
changed_when: true
|
|
no_log: true
|
|
|
|
- name: Read back PBS storage configuration
|
|
ansible.builtin.command:
|
|
argv:
|
|
- pvesh
|
|
- get
|
|
- /storage/pbs
|
|
- --output-format
|
|
- json
|
|
register: pbs_storage_after_raw
|
|
changed_when: false
|
|
no_log: true
|
|
|
|
- name: Parse read-back PBS storage configuration
|
|
ansible.builtin.set_fact:
|
|
pbs_storage_after: "{{ pbs_storage_after_raw.stdout | from_json }}"
|
|
no_log: true
|
|
|
|
- name: Assert storage-level prune policy is absent
|
|
ansible.builtin.assert:
|
|
that:
|
|
- pbs_storage_after.storage | default('') == 'pbs'
|
|
- pbs_storage_after.type | default('') == 'pbs'
|
|
- pbs_storage_after.get('prune-backups') is none
|
|
fail_msg: Storage-level prune policy still exists on /storage/pbs after the declarative fix.
|
|
no_log: true
|