Moved sys-opt-ssd-hdd to a callable version in svc-opt-ssd-hdd

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-12 11:42:25 +02:00
parent f2187e4bc0
commit c09dec8b0f
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
18 changed files with 48 additions and 40 deletions

View File

@ -27,7 +27,7 @@ clean:
tree:
@echo Generating Tree
python3 main.py generate tree -L 1
python3 main.py generate tree -D 2 --no-signal
build:
@echo "🔧 Generating users defaults → $(USERS_OUT)"

View File

@ -28,7 +28,7 @@ system_maintenance_cleanup_services:
system_maintenance_manipulation_services:
- "sys-rpr-docker-soft"
- "update-docker"
- "sys-opt-ssd-hdd"
- "svc-opt-ssd-hdd"
- "sys-rpr-docker-hard"
## Total System Maintenance Services

View File

@ -4,6 +4,7 @@ roles:
invokable: false
sys:
title: "System"
description: "System near components. Will be automaticly called if necessary from other roles."
invokable: false
alm:
title: "Alerting"
@ -104,6 +105,12 @@ roles:
description: "Docker infrastructure services (DBMS, LDAP, Redis, etc.)"
icon: "fas fa-database"
invokable: true
opt:
title: "Service Optimation"
description: "Optimation Services to improve your system"
icon: "fas fa-database"
invokable: true
user:
title: "Users & Access"
description: "User accounts & access control"

View File

@ -16,7 +16,7 @@
group: administrator
when: run_once_docker is not defined
- name: Set docker_enabled to true, to activate sys-opt-ssd-hdd
- name: Set docker_enabled to true, to activate svc-opt-ssd-hdd
set_fact:
docker_enabled: true
when: run_once_docker is not defined

View File

@ -0,0 +1,5 @@
- name: "reload svc-opt-ssd-hdd.cymais.service"
systemd:
name: svc-opt-ssd-hdd.cymais.service
state: reloaded
daemon_reload: yes

View File

@ -0,0 +1,22 @@
- name: "create {{storage_optimizer_directory}}"
file:
path: "{{storage_optimizer_directory}}"
state: directory
mode: 0755
- name: create svc-opt-ssd-hdd.cymais.service
template:
src: svc-opt-ssd-hdd.service.j2
dest: /etc/systemd/system/svc-opt-ssd-hdd.cymais.service
notify: reload svc-opt-ssd-hdd.cymais.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.cymais.service
state: started

View File

@ -4,5 +4,5 @@ OnFailure=sys-alm-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore sys-opt-ssd-hdd svc-sys-bkp-rmt-2-loc --timeout "{{system_maintenance_lock_timeout_storage_optimizer}}"'
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore svc-opt-ssd-hdd svc-sys-bkp-rmt-2-loc --timeout "{{system_maintenance_lock_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}}'

View File

@ -0,0 +1,3 @@
storage_optimizer_directory: '{{path_administrator_scripts}}svc-opt-ssd-hdd/'
storage_optimizer_script: '{{storage_optimizer_directory}}svc-opt-ssd-hdd.py'
application_id: svc-opt-ssd-hdd

View File

@ -1,5 +0,0 @@
- name: "reload sys-opt-ssd-hdd.cymais.service"
systemd:
name: sys-opt-ssd-hdd.cymais.service
state: reloaded
daemon_reload: yes

View File

@ -1,22 +0,0 @@
- name: "create {{storage_optimizer_directory}}"
file:
path: "{{storage_optimizer_directory}}"
state: directory
mode: 0755
- name: create sys-opt-ssd-hdd.cymais.service
template:
src: sys-opt-ssd-hdd.service.j2
dest: /etc/systemd/system/sys-opt-ssd-hdd.cymais.service
notify: reload sys-opt-ssd-hdd.cymais.service
- name: create sys-opt-ssd-hdd.py
copy:
src: sys-opt-ssd-hdd.py
dest: "{{storage_optimizer_script}}"
mode: 0755
- name: "optimize storage performance"
systemd:
name: sys-opt-ssd-hdd.cymais.service
state: started

View File

@ -1,2 +0,0 @@
storage_optimizer_directory: '{{path_administrator_scripts}}sys-opt-ssd-hdd/'
storage_optimizer_script: '{{storage_optimizer_directory}}sys-opt-ssd-hdd.py'

View File

@ -1,6 +1,6 @@
#- name: "Load destruction roles"
# include_tasks: "./tasks/groups/{{ item }}-roles.yml"
# loop:
# - cln
# loop_control:
# label: "{{ item }}-roles.yml"
- name: "Load destruction roles"
include_tasks: "./tasks/groups/{{ item }}-roles.yml"
loop:
- svc-opt # Optimation services
loop_control:
label: "{{ item }}-roles.yml"

View File

@ -8,7 +8,7 @@ import sys
def load_optimizer_module():
module_path = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'..', "..", "..","..",'roles', 'sys-opt-ssd-hdd', 'files', 'sys-opt-ssd-hdd.py'
'..', "..", "..","..",'roles', 'svc-opt-ssd-hdd', 'files', 'svc-opt-ssd-hdd.py'
))
spec = importlib.util.spec_from_file_location('storage_optimizer', module_path)
optimizer = importlib.util.module_from_spec(spec)