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