Refactor systemctl services and categories due to alarm bugs

This commit restructures systemctl service definitions and category mappings.

Motivation: Alarm-related bugs revealed inconsistencies in service and role handling.

Preparation step: lays the groundwork for fixing the alarm issues by aligning categories, roles, and service templates.
This commit is contained in:
2025-08-18 13:35:43 +02:00
parent 29f50da226
commit 3a839cfe37
289 changed files with 975 additions and 948 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-ctl-alm-compose.

View File

@@ -0,0 +1,4 @@
- name: "reload sys-ctl-rpr-btrfs-balancer service"
systemd:
name: sys-ctl-rpr-btrfs-balancer{{ SYS_SERVICE_SUFFIX }}
daemon_reload: yes

View File

@@ -0,0 +1,22 @@
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: "Infinito.Nexus NonCommercial License"
license_url: "https://s.infinito.nexus/license"
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.infinito.nexus/code"
issue_tracker_url: "https://s.infinito.nexus/issues"
documentation: "https://docs.infinito.nexus"

View File

@@ -0,0 +1,26 @@
- name: Include dependency 'sys-ctl-alm-compose'
include_role:
name: sys-ctl-alm-compose
when: run_once_sys_ctl_alm_compose is not defined
- name: "pkgmgr install"
include_role:
name: pkgmgr-install
vars:
package_name: btrfs-auto-balancer
- name: configure sys-ctl-rpr-btrfs-balancer{{ SYS_SERVICE_SUFFIX }}
template:
src: sys-ctl-rpr-btrfs-balancer.service.j2
dest: /etc/systemd/system/sys-ctl-rpr-btrfs-balancer{{ SYS_SERVICE_SUFFIX }}
notify: reload sys-ctl-rpr-btrfs-balancer service
- name: "set 'service_name' to '{{ role_name }}'"
set_fact:
service_name: "{{ role_name }}"
- name: "include role for sys-timer for {{ service_name }}"
include_role:
name: sys-timer
vars:
on_calendar: "{{SYS_SCHEDULE_REPAIR_BTRFS_AUTO_BALANCER}}"

View File

@@ -0,0 +1,4 @@
- block:
- include_tasks: 01_core.yml
- include_tasks: utils/run_once.yml
when: run_once_sys_ctl_rpr_btrfs_balancer is not defined

View File

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