Another big round of refactoring and cleaning...

This commit is contained in:
2025-07-11 17:55:26 +02:00
parent aa61bf2a44
commit 168c5c0da6
323 changed files with 761 additions and 811 deletions

View File

@@ -0,0 +1,24 @@
# System Btrfs Auto Balancer
## Description
This role automates the management and balancing of Btrfs file systems. It clones the latest version of the [auto-btrfs-balancer](https://github.com/kevinveenbirkenbach/auto-btrfs-balancer.git) repository and configures a systemd service and timer to run the balancing script automatically.
## Overview
Optimized for automated file system management, this role:
- Clones the auto-btrfs-balancer repository.
- Configures a systemd service to run the balancing script.
- Integrates a systemd timer for regular execution.
- Notifies via systemd in case of errors during the balancing process.
## Purpose
The primary purpose of this role is to maintain optimal performance of Btrfs file systems by automating balancing tasks, ensuring efficient storage allocation and performance.
## Features
- **Repository Cloning:** Automatically fetches the latest auto-btrfs-balancer repository.
- **Service Configuration:** Sets up a systemd service for running the balancing script.
- **Timer Integration:** Schedules the balancing process via a systemd timer.
- **Error Notification:** Notifies on failure using sys-alm-compose.

View File

@@ -0,0 +1,4 @@
- name: "reload sys-rpr-btrfs-blnc.cymais.service"
systemd:
name: sys-rpr-btrfs-blnc.cymais.service
daemon_reload: yes

View File

@@ -0,0 +1,25 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Automates the balancing of Btrfs file systems by cloning the auto-btrfs-balancer repository and configuring a systemd service and timer for regular execution."
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: Archlinux
versions:
- rolling
galaxy_tags:
- btrfs
- balancing
- filesystem
- automation
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- sys-alm-compose

View File

@@ -0,0 +1,30 @@
- name: "pkgmgr install"
include_role:
name: pkgmgr-install
vars:
package_name: btrfs-auto-balancer
when: run_once_system_btrfs_auto_balancer is not defined
- name: configure sys-rpr-btrfs-blnc.cymais.service
template:
src: sys-rpr-btrfs-blnc.service.j2
dest: /etc/systemd/system/sys-rpr-btrfs-blnc.cymais.service
notify: reload sys-rpr-btrfs-blnc.cymais.service
when: run_once_system_btrfs_auto_balancer is not defined
- name: "set 'service_name' to '{{ role_name }}'"
set_fact:
service_name: "{{ role_name }}"
when: run_once_system_btrfs_auto_balancer is not defined
- name: "include role for sys-timer for {{service_name}}"
include_role:
name: sys-timer
vars:
on_calendar: "{{on_calendar_btrfs_auto_balancer}}"
when: run_once_system_btrfs_auto_balancer is not defined
- name: run the system_btrfs_auto_balancer tasks once
set_fact:
run_once_system_btrfs_auto_balancer: true
when: run_once_system_btrfs_auto_balancer is not defined

View File

@@ -0,0 +1,7 @@
[Unit]
Description=auto balance btrfs
OnFailure=sys-alm-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'btrfs-auto-balancer 90 10'

View File

@@ -0,0 +1,2 @@
system_btrfs_auto_balancer_folder: '{{path_administrator_scripts}}auto-btrfs-balancer/'