Optimized .mds and meta/main.yml for cleanup roles

This commit is contained in:
Kevin Veen-Birkenbach 2025-03-14 13:48:15 +01:00
parent abdddc0d42
commit 17e2c992b3
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
9 changed files with 188 additions and 17 deletions

View File

@ -0,0 +1,7 @@
It may be neccessary to install gcc seperat to use psutil
```bash
sudo pacman -S gcc
```
If this is the case in the future, automize it in this role.

View File

@ -1,14 +1,27 @@
# role cleanup-backups-timer
# Cleanup Backups Service
Cleans up old backups
## Description
## Additional software
This role automates the cleanup of old backups by executing a Python script that deletes outdated backup versions based on disk usage thresholds. It ensures that backup storage does not exceed a defined usage percentage.
It may be neccessary to install gcc seperat to use psutil
## Overview
```bash
sudo pacman -S gcc
```
Optimized for effective disk space management, this role:
- Installs required packages (e.g. [lsof](https://en.wikipedia.org/wiki/Lsof) and [psutil](https://pypi.org/project/psutil/)) using pacman.
- Creates a directory for storing cleanup scripts.
- Deploys a Python script that deletes old backup directories when disk usage is too high.
- Configures a systemd service to run the cleanup script, with notifications via [systemd-notifier](../systemd-notifier/README.md).
## further information
## Purpose
The primary purpose of this role is to maintain optimal backup storage by automatically removing outdated backup versions when disk usage exceeds a specified threshold.
## Features
- **Automated Cleanup:** Executes a Python script to delete old backups.
- **Threshold-Based Deletion:** Removes backups based on disk usage percentage.
- **Systemd Integration:** Configures a systemd service to run cleanup tasks.
- **Dependency Integration:** Works in conjunction with related roles for comprehensive backup management.
## Further Information
- https://stackoverflow.com/questions/48929553/get-hard-disk-size-in-python

View File

@ -1,3 +1,26 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Automates the cleanup of old backups by executing a Python script that deletes outdated backup versions when disk usage exceeds a specified threshold."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Linux
versions:
- all
galaxy_tags:
- backup
- cleanup
- disk
- automation
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- python-pip
- systemd-notifier

View File

@ -1,3 +1,21 @@
# role cleanup-backups-timer
# Cleanup Backups Timer
Timer for cleaning up old backups
## Description
This role sets up a systemd timer to schedule the periodic cleanup of old backups. It leverages the cleanup-backups-service role to perform the actual cleanup operation.
## Overview
Optimized for automated maintenance, this role:
- Sets a fact for the service name.
- Integrates with the [systemd-timer](../systemd-timer/README.md) role to schedule cleanup-backups tasks at defined intervals.
## Purpose
The primary purpose of this role is to automate the scheduling of backup cleanup operations using a systemd timer, ensuring that backup storage remains within defined limits.
## Features
- **Timer Scheduling:** Configures a systemd timer to trigger the backup cleanup service.
- **Role Integration:** Works in conjunction with the cleanup-backups-service role.
- **Idempotency:** Ensures the timer tasks execute only once per playbook run.

View File

@ -1,2 +1,25 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Schedules periodic cleanup of old backups by configuring a systemd timer to trigger the cleanup-backups-service role."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Linux
versions:
- all
galaxy_tags:
- timer
- backup
- cleanup
- automation
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- cleanup-backups-service

View File

@ -1,4 +1,24 @@
# cleanup-disc-space
Frees disc space
## More information
- https://askubuntu.com/questions/380238/how-to-clean-tmp
# Cleanup Disc Space
## Description
This role frees disk space by executing a script that cleans up temporary files, clears package caches, and optionally cleans up backup directories and Docker resources when disk usage exceeds a specified threshold.
## Overview
Optimized for efficient storage management, this role:
- Creates a directory for disk cleanup scripts.
- Deploys a Bash script that frees disk space by cleaning up /tmp, Docker resources, and pacman cache.
- Configures a systemd service to run the disk cleanup script.
- Optionally integrates with backup cleanup if backup variables are defined.
## Purpose
The primary purpose of this role is to ensure that disk space remains within safe limits by automating cleanup tasks, thereby improving system performance and stability.
## Features
- **Automated Cleanup:** Executes a script to remove temporary files and clear caches.
- **Threshold-Based Execution:** Triggers cleanup when disk usage exceeds a defined percentage.
- **Systemd Integration:** Configures a systemd service to manage the disk cleanup process.
- **Docker and Backup Integration:** Optionally cleans Docker resources and backups if configured.

View File

@ -1,3 +1,26 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Frees disk space on the target system by executing a cleanup script that removes temporary files, clears package caches, and optionally handles Docker and backup cleanup."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Linux
versions:
- all
galaxy_tags:
- disk
- cleanup
- storage
- automation
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- systemd-notifier
- system-maintenance-lock

View File

@ -1,3 +1,24 @@
# Docker Volume Backup Cleanup
This script cleans up failed docker backups.
It uses https://github.com/kevinveenbirkenbach/cleanup-failed-docker-backups as base.
# Docker Volume Backup Cleanup Role
## Description
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 cleanup-failed-docker-backups repository.
- Configures a systemd service to run the cleanup script.
- Integrates with the [systemd-timer](../systemd-timer/README.md) role to schedule periodic cleanup.
- Works in conjunction with the backup-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 backup-directory-validator to enhance backup integrity.

View File

@ -1,3 +1,26 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Cleans up failed Docker backups by configuring a systemd service and timer to execute the cleanup operations periodically."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Linux
versions:
- all
galaxy_tags:
- docker
- backup
- cleanup
- automation
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- git
- systemd-notifier