Refactor systemctl services and timers

- Unified service templates into generic systemctl templates
- Introduced reusable filter plugins for script path handling
- Updated path variables and service/timer definitions
- Migrated roles (backup, cleanup, repair, etc.) to use systemctl role
- Added sys-daemon role for core systemd cleanup
- Simplified timer handling via sys-timer role

Note: This is a large refactor and some errors may still exist. Further testing and adjustments will be needed.
This commit is contained in:
2025-08-18 21:22:16 +02:00
parent 3a839cfe37
commit 2569abc0be
219 changed files with 618 additions and 1104 deletions

View File

@@ -2,5 +2,7 @@
# Path Variables for Key Directories and Scripts
PATH_ADMINISTRATOR_HOME: "/home/administrator/"
PATH_ADMINISTRATOR_SCRIPTS: "/opt/scripts/"
PATH_SYSTEMCTL_SCRIPTS: "{{ [ PATH_ADMINISTRATOR_SCRIPTS, 'systemctl' ] | path_join }}"
PATH_DOCKER_COMPOSE_INSTANCES: "/opt/docker/"
PATH_SYSTEM_LOCK_SCRIPT: "/opt/scripts/sys-lock.py"
PATH_SYSTEM_LOCK_SCRIPT: "/opt/scripts/sys-lock.py"
PATH_SYSTEM_SERVICE_DIR: "/etc/systemd/system"

View File

@@ -2,10 +2,20 @@
# Services
## Meta
SYS_SERVICE_SUFFIX: ".{{ SOFTWARE_NAME | lower }}.service"
SYS_SERVICE_SUFFIX: ".{{ SOFTWARE_NAME | lower }}.service"
## Names
SYS_SERVICE_ALARM_CMP: "sys-ctl-alm-compose.{{ SOFTWARE_NAME }}@.service"
SYS_SERVICE_CLEANUP_BACKUPS_OLD: "sys-ctl-cln-backups{{ SYS_SERVICE_SUFFIX }}"
SYS_SERVICE_CLEANUP_BACKUPS_FAILED: "sys-ctl-cln-faild-bkps{{ SYS_SERVICE_SUFFIX }}"
SYS_SERVICE_OPTIMIZE_DRIVE: "svc-opt-ssd-hdd{{ SYS_SERVICE_SUFFIX }}"
SYS_SERVICE_BACKUP_RMT_2_LOC: "svc-bkp-rmt-2-loc{{ SYS_SERVICE_SUFFIX }}"
SYS_SERVICE_REPAIR_DOCKER_HARD: "sys-ctl-rpr-docker-hard{{ SYS_SERVICE_SUFFIX }}"
SYS_SERVICE_UPDATE_DOCKER: "update-docker{{ SYS_SERVICE_SUFFIX }}"
## On Failure
SYS_SERVICE_ON_FAILURE_COMPOSE: "sys-ctl-alm-compose.{{ SOFTWARE_NAME }}@%i.service"
SYS_SERVICE_ON_FAILURE_EMAIL: "sys-ctl-alm-email.{{ SOFTWARE_NAME }}@%i.service"
SYS_SERVICE_ON_FAILURE_TELEGRAM: "sys-ctl-alm-telegram.{{ SOFTWARE_NAME }}@%i.service"
## Groups
SYS_SERVICE_GROUP_BACKUPS: >
@@ -36,5 +46,6 @@ SYS_SERVICE_GROUP_MANIPULATION: >
SYS_SERVICE_GROUP_REPAIR +
SYS_SERVICE_GROUP_OPTIMIZATION +
SYS_SERVICE_GROUP_MAINTANANCE +
[ 'update-docker' ]
[ SYS_SERVICE_UPDATE_DOCKER ]
}}

View File

@@ -1,6 +1,6 @@
backups_folder_path: "/Backups/" # Path to the backups folder
BACKUPS_FOLDER_PATH: "/Backups/" # Path to the backups folder
# Storage Space-Related Configurations
size_percent_maximum_backup: 75 # Maximum storage space in percent for backups
size_percent_cleanup_disc_space: 85 # Threshold for triggering cleanup actions
size_percent_disc_space_warning: 90 # Warning threshold in percent for free disk space
SIZE_PERCENT_MAXIMUM_BACKUP: 75 # Maximum storage space in percent for backups
SIZE_PERCENT_CLEANUP_DISC_SPACE: 85 # Threshold for triggering cleanup actions
SIZE_PERCENT_DISC_SPACE_WARNING: 90 # Warning threshold in percent for free disk space