Optimized system services included suppress option and solved bugs

This commit is contained in:
2025-08-27 17:34:59 +02:00
parent a8f4dea9d2
commit bae2bc21ec
6 changed files with 16 additions and 19 deletions

View File

@@ -6,6 +6,7 @@
- include_role: - include_role:
name: sys-service name: sys-service
vars: vars:
system_service_on_calendar: "{{SYS_SCHEDULE_HEALTH_JOURNALCTL}}" system_service_on_calendar: "{{ SYS_SCHEDULE_HEALTH_JOURNALCTL }}"
system_service_timer_enabled: true system_service_timer_enabled: true
system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}" system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}"
# system_service_suppress_flush: true # There are almost allways errors in the journalctl logs so suppression is neccessary to let playbook run

View File

@@ -12,7 +12,8 @@
- include_role: - include_role:
name: sys-service name: sys-service
vars: vars:
system_service_copy_files: false system_service_copy_files: false
system_service_on_calendar: "{{SYS_SCHEDULE_REPAIR_BTRFS_AUTO_BALANCER}}" system_service_on_calendar: "{{ SYS_SCHEDULE_REPAIR_BTRFS_AUTO_BALANCER }}"
system_service_timer_enabled: true system_service_timer_enabled: true
system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}" system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}"
system_service_tpl_exec_start: "/bin/sh -c 'btrfs-auto-balancer 90 10'"

View File

@@ -1,7 +0,0 @@
[Unit]
Description=auto balance btrfs
OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }}
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'btrfs-auto-balancer 90 10'

View File

@@ -1,3 +1,4 @@
SYS_SERVICE_ALL_ENABLED: "{{ MODE_DEBUG }}" SYS_SERVICE_ALL_ENABLED: "{{ MODE_DEBUG }}"
SYS_SERVICE_DEFAULT_STATE: "{{ 'restarted' if MODE_DEBUG else omit }}" SYS_SERVICE_DEFAULT_STATE: "{{ 'restarted' if MODE_DEBUG else omit }}"
SYS_SERVICE_DEFAULT_RUNTIME: "86400s" # Maximum total runtime a service is allowed to run before being stopped SYS_SERVICE_DEFAULT_RUNTIME: "86400s" # Maximum total runtime a service is allowed to run before being stopped
SYS_SERVICE_SUPPRESS_FLUSH: [] # Services where the flush should be suppressed

View File

@@ -46,5 +46,5 @@
command: /bin/true command: /bin/true
notify: refresh systemctl service notify: refresh systemctl service
when: not system_service_uses_at when: not system_service_uses_at
when: SYS_SERVICE_ALL_ENABLED | bool or system_force_flush | bool when: (SYS_SERVICE_ALL_ENABLED | bool or system_force_flush | bool) and not system_service_suppress_flush | bool

View File

@@ -6,9 +6,10 @@ system_service_role_dir: "{{ [ playbook_dir, 'roles', system_service_role_
system_service_script_dir: "{{ [ PATH_SYSTEMCTL_SCRIPTS, system_service_id ] | path_join }}" system_service_script_dir: "{{ [ PATH_SYSTEMCTL_SCRIPTS, system_service_id ] | path_join }}"
## Settings ## Settings
system_force_flush: false # When set to true it activates the flushing of services :) system_force_flush: false # When set to true it activates the flushing of services :)
system_service_copy_files: true # When set to false file copying will be skipped system_service_suppress_flush: "{{ (system_service_id in SYS_SERVICE_SUPPRESS_FLUSH) | bool }}" # When set to true it suppresses the flushing of services
system_service_timer_enabled: false # When set to true timer will be loaded system_service_copy_files: true # When set to false file copying will be skipped
system_service_timer_enabled: false # When set to true timer will be loaded
system_service_state: "{{ SYS_SERVICE_DEFAULT_STATE }}" system_service_state: "{{ SYS_SERVICE_DEFAULT_STATE }}"
# Dynamic Loaded ( Just available when dependencies are loaded ) # Dynamic Loaded ( Just available when dependencies are loaded )