mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
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:
@@ -1,5 +0,0 @@
|
||||
- name: "reload svc-opt-ssd-hdd service"
|
||||
systemd:
|
||||
name: svc-opt-ssd-hdd{{ SYS_SERVICE_SUFFIX }}
|
||||
state: reloaded
|
||||
daemon_reload: yes
|
@@ -4,8 +4,8 @@ credentials:
|
||||
algorithm: "bcrypt"
|
||||
validation: "^\\$2[aby]\\$.{56}$"
|
||||
|
||||
path_rapid_storage:
|
||||
OPT_DRIVE_RAPID_STORAGE_PATH:
|
||||
description: "Mount path of the servers SSD"
|
||||
|
||||
path_mass_storage:
|
||||
OPT_DRIVE_MASS_STORAGE_PATH:
|
||||
description: "Mount path of the servers HDD"
|
@@ -1,22 +1,2 @@
|
||||
- name: "create {{storage_optimizer_directory}}"
|
||||
file:
|
||||
path: "{{storage_optimizer_directory}}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: create svc-opt-ssd-hdd{{ SYS_SERVICE_SUFFIX }}
|
||||
template:
|
||||
src: svc-opt-ssd-hdd.service.j2
|
||||
dest: /etc/systemd/system/svc-opt-ssd-hdd{{ SYS_SERVICE_SUFFIX }}
|
||||
notify: reload svc-opt-ssd-hdd service
|
||||
|
||||
- name: create svc-opt-ssd-hdd.py
|
||||
copy:
|
||||
src: svc-opt-ssd-hdd.py
|
||||
dest: "{{storage_optimizer_script}}"
|
||||
mode: "0755"
|
||||
|
||||
- name: "optimize storage performance"
|
||||
systemd:
|
||||
name: svc-opt-ssd-hdd{{ SYS_SERVICE_SUFFIX }}
|
||||
state: started
|
||||
- include_role:
|
||||
name: sys-systemctl
|
@@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=Optimize storage paths
|
||||
OnFailure=sys-ctl-alm-compose.{{ SOFTWARE_NAME }}@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore svc-opt-ssd-hdd svc-bkp-rmt-2-loc --timeout "{{SYS_TIMEOUT_STORAGE_OPTIMIZER}}"'
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{storage_optimizer_script}} --rapid-storage-path {{path_rapid_storage}} --mass-storage-path {{path_mass_storage}}'
|
8
roles/svc-opt-ssd-hdd/templates/systemctl.service.j2
Normal file
8
roles/svc-opt-ssd-hdd/templates/systemctl.service.j2
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Optimize storage paths
|
||||
OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore {{ SYS_SERVICE_OPTIMIZE_DRIVE }} {{ SYS_SERVICE_BACKUP_RMT_2_LOC }} --timeout "{{ SYS_TIMEOUT_STORAGE_OPTIMIZER }}"'
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{ systemctl_id | get_service_script_path('sh') }} --rapid-storage-path {{ OPT_DRIVE_RAPID_STORAGE_PATH }} --mass-storage-path {{ OPT_DRIVE_MASS_STORAGE_PATH }}'
|
@@ -1,5 +1,4 @@
|
||||
application_id: svc-opt-ssd-hdd
|
||||
storage_optimizer_directory: '{{ PATH_ADMINISTRATOR_SCRIPTS }}{{ application_id }}/'
|
||||
storage_optimizer_script: '{{ storage_optimizer_directory }}{{ application_id }}.py'
|
||||
path_rapid_storage: "{{ applications | get_app_conf(application_id, 'volumes.rapid_storage') }}"
|
||||
path_mass_storage: "{{ applications | get_app_conf(application_id, 'volumes.mass_storage') }}"
|
||||
systemctl_id: "{{ application_id }}"
|
||||
OPT_DRIVE_RAPID_STORAGE_PATH: "{{ applications | get_app_conf(application_id, 'volumes.rapid_storage') }}"
|
||||
OPT_DRIVE_MASS_STORAGE_PATH: "{{ applications | get_app_conf(application_id, 'volumes.mass_storage') }}"
|
||||
|
Reference in New Issue
Block a user