mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-21 20:31:02 +01:00
Integration of freezer to services. See https://chat.openai.com/share/c9f5587b-0a60-4005-9329-e53754e3fcfa
This commit is contained in:
parent
518b98cfd1
commit
8c89d08980
@ -26,10 +26,11 @@ size_percent_disc_space_warning: 85
|
||||
size_percent_cleanup_disc_space: 90
|
||||
|
||||
# Path Variables
|
||||
path_administrator_home: "/home/administrator/"
|
||||
path_administrator_scripts: "{{path_administrator_home}}scripts/"
|
||||
path_docker_volumes: "{{path_administrator_home}}volumes/docker/"
|
||||
path_docker_compose_instances: "{{path_administrator_home}}docker-compose/"
|
||||
path_administrator_home: "/home/administrator/"
|
||||
path_administrator_scripts: "{{path_administrator_home}}scripts/"
|
||||
path_docker_volumes: "{{path_administrator_home}}volumes/docker/"
|
||||
path_docker_compose_instances: "{{path_administrator_home}}docker-compose/"
|
||||
path_system_maintenance_service_freezer_script: "{{path_administrator_scripts}}system-maintenance-service-freezer.py"
|
||||
|
||||
# Runtime Variables
|
||||
activate_all_timers: false # Activates all timers, independend if the handlers had been triggered
|
||||
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "backup-docker-to-local") | join(',') }}"'
|
||||
ExecStart=/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "backup-remote-to-local") | join(',') }}"'
|
||||
ExecStart=/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
||||
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-backups") | join(',') }}"'
|
||||
ExecStart=/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-disc-space") | join(',') }}"'
|
||||
ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}}'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-failed-docker-backups") | join(',') }}"'
|
||||
ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}}'
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "heal-docker") | join(',') }}"'
|
||||
ExecStart=/bin/python {{heal_docker}}heal-docker.py
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
@ -1,8 +1,8 @@
|
||||
---
|
||||
- name: create {{freezer_script}}
|
||||
- name: create {{path_system_maintenance_service_freezer_script}}
|
||||
copy:
|
||||
src: system-maintenance-service-freezer.py
|
||||
dest: "{{freezer_script}}"
|
||||
dest: "{{path_system_maintenance_service_freezer_script}}"
|
||||
|
||||
- name: Configure system-maintenance-service for each action
|
||||
loop:
|
||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{ freezer_script }} {{item}} {{ system_maintenance_services | join(",") }}'
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} {{ system_maintenance_services | join(",") }}'
|
@ -1 +0,0 @@
|
||||
freezer_script: "{{path_administrator_scripts}}system-maintenance-service-freezer.py"
|
@ -4,4 +4,6 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}}'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "update-docker") | join(',') }}"'
|
||||
ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}}'
|
||||
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'
|
Loading…
Reference in New Issue
Block a user