feat(sys-ctl-cln-faild-bkps): migrate role to cleanback CLI (systemd oneshot) and derive workers from Ansible facts

- install via pkgmgr (CLEANUP_FAILED_BACKUPS_PKG=cleanback)
- run: cleanback --all --dirval-cmd dirval --workers {{ CLEANUP_FAILED_BACKUPS_WORKERS }} --timeout {{ CLEANBACK_TIMEOUT_SECONDS }} --yes
- remove obsolete systemctl template and path set_fact logic
- keep task variable names intact; no defaults for runtime knobs
- update README to reflect new behavior

Conversation: https://chatgpt.com/share/68c309bf-8818-800f-84d9-c4aa74a4544c
This commit is contained in:
2025-09-11 20:30:29 +02:00
parent 3224e24d76
commit d40a275d70
4 changed files with 26 additions and 50 deletions

View File

@@ -1,24 +1,13 @@
# Docker Volume Backup Cleanup Role
# Cleanup Failed Backups
## Description
This role installs and runs the **cleanback** CLI to validate and delete **failed Docker backups** under `/Backups/*/backup-docker-to-local`.
Validation is performed via `dirval`; failures can be removed automatically in a non-interactive service execution.
This role cleans up failed Docker backups by pulling a [Git repository](https://github.com/kevinveenbirkenbach/cleanup-failed-docker-backups) that contains cleanup scripts and configuring a systemd service to execute them. It ensures that failed or incomplete backups are removed to free up disk space and maintain a healthy backup environment.
## Overview
Optimized for backup maintenance, this role:
- Clones the sys-ctl-cln-faild-bkps repository.
- Configures a systemd service to run the cleanup script.
- Integrates with the [sys-timer](../sys-timer/README.md) role to schedule periodic cleanup.
- Works in conjunction with the sys-svc-directory-validator role for additional verification.
## Purpose
The primary purpose of this role is to remove failed Docker backups automatically, thereby freeing disk space and preventing backup storage from becoming cluttered with incomplete data.
## Features
- **Repository Cloning:** Retrieves the latest cleanup scripts from a Git repository.
- **Service Configuration:** Sets up a systemd service to run the cleanup tasks.
- **Timer Integration:** Schedules periodic cleanup through a systemd timer.
- **Dependency Integration:** Works with sys-svc-directory-validator to enhance backup integrity.
## Behavior
- Installs `cleanback` via `pkgmgr`.
- Runs `cleanback` (`main.py`) as a **systemd oneshot** service.
- Executes `--all` with `--yes` so failing directories are deleted automatically.
- **No defaults** for runtime knobs:
- `CLEANBACK_TIMEOUT_SECONDS` (required)
- `SYS_SCHEDULE_CLEANUP_FAILED_BACKUPS` (required)
- **Workers** (`CLEANUP_FAILED_BACKUPS_WORKERS`) are **derived from Ansible facts only** (no arbitrary defaults). Facts **must** be gathered.