Finished storage-optimizer draft

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-10 12:13:38 +01:00
parent 71b76f2b35
commit 905b8b5e71
7 changed files with 37 additions and 8 deletions

View File

@ -92,6 +92,7 @@ system_maintenance_cleanup_services:
system_maintenance_manipulation_services:
- "heal-docker"
- "update-docker"
- "storage-optimizer"
## Total System Maintenance Services
system_maintenance_services: "{{ system_maintenance_backup_services + system_maintenance_cleanup_services + system_maintenance_manipulation_services }}"

View File

@ -46,3 +46,6 @@ pixelfed_app_key: "I_NEED_TO_CHANGE_THIS_UNSECURE_PASSWORD"
wordpress_database_password: "I_NEED_TO_CHANGE_THIS_UNSECURE_PASSWORD"
yourls_database_password: "I_NEED_TO_CHANGE_THIS_UNSECURE_PASSWORD"
yourls_user_password: "I_NEED_TO_CHANGE_THIS_UNSECURE_PASSWORD"
path_mass_storage: "/mnt/hdd/"
path_rapid_storage: "/mnt/ssd/"

View File

@ -2,10 +2,3 @@
systemd:
name: backup-remote-to-local.cymais.service
daemon_reload: yes
- name: "restart backup-remote-to-local timer"
systemd:
name: backup-remote-to-local.cymais.timer
state: started
enabled: yes
daemon_reload: yes

View File

@ -0,0 +1,4 @@
- name: "reload storage-optimizer service"
systemd:
name: storage-optimizer.cymais.service
daemon_reload: yes

View File

@ -0,0 +1,18 @@
- name: "create {{storage_optimizer_directory}}"
file:
path: "{{storage_optimizer_directory}}"
state: directory
mode: 0755
- name: create storage-optimizer.cymais.service
template:
src: storage-optimizer.service.j2
dest: /etc/systemd/system/storage-optimizer.cymais.service
notify: reload storage-optimizer service
- name: create storage-optimizer.py
template:
src: storage-optimizer.py.j2
dest: "{{storage_optimizer_script}}"
mode: 0755
notify: reload storage-optimizer service

View File

@ -0,0 +1,8 @@
[Unit]
Description=Optimize storage paths
OnFailure=systemd-notifier.cymais@%n.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }}'
ExecStart=/bin/sh -c '/usr/bin/python {{storage_optimizer_script}} --rapid-storage-path {{rapid_mass_storage}} --mass-storage-path {{path_mass_storage}}'

View File

@ -0,0 +1,2 @@
storage_optimizer_directory: "{{path_administrator_scripts}}storage-optimizer/"
storage_optimizer_script: "{{storage_optimizer_directory}}storage-optimizer.py"