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

This commit is contained in:
2025-03-14 13:48:15 +01:00
parent abdddc0d42
commit 17e2c992b3
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