From 839b1b433dc43c0d06eed72a9d26596e2f44416c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 17 Nov 2023 12:35:39 +0100 Subject: [PATCH] optimized variable names --- group_vars/all | 22 +++++++++---------- roles/backup-docker-to-local/tasks/main.yml | 8 +++---- .../backup-docker-to-local.service.j2 | 2 +- .../templates/backup-docker-to-local.timer.j2 | 2 +- roles/backup-docker-to-local/vars/main.yml | 2 +- roles/backup-remote-to-local/tasks/main.yml | 12 +++++----- .../backup-remote-to-local.service.j2 | 2 +- .../templates/backup-remote-to-local.sh.j2 | 2 +- .../templates/backup-remote-to-local.timer.j2 | 2 +- roles/backup-remote-to-local/vars/main.yml | 2 +- roles/cleanup-backups-service/tasks/main.yml | 6 ++--- .../templates/cleanup-backups.service.j2 | 2 +- roles/cleanup-backups-service/vars/main.yml | 2 +- .../templates/cleanup-backups.timer.j2 | 2 +- roles/cleanup-disc-space/tasks/main.yml | 6 ++--- .../templates/cleanup-disc-space.service.j2 | 2 +- .../templates/cleanup-disc-space.sh.j2 | 10 ++++----- .../templates/cleanup-disc-space.timer.j2 | 2 +- roles/cleanup-disc-space/vars/main.yml | 2 +- .../tasks/main.yml | 2 +- .../cleanup-failed-docker-backups.service.j2 | 2 +- .../vars/main.yml | 2 +- roles/heal-docker/tasks/main.yml | 6 ++--- .../templates/heal-docker.service.j2 | 2 +- .../templates/heal-docker.timer.j2 | 2 +- roles/heal-docker/vars/main.yml | 2 +- roles/health-btrfs/tasks/main.yml | 6 ++--- .../templates/health-btrfs.service.j2 | 2 +- .../templates/health-btrfs.timer.j2 | 2 +- roles/health-btrfs/vars/main.yml | 2 +- .../files/health-disc-space.sh | 6 ++--- roles/health-disc-space/tasks/main.yml | 6 ++--- .../templates/health-disc-space.service.j2 | 2 +- .../templates/health-disc-space.timer.j2 | 2 +- roles/health-disc-space/vars/main.yml | 2 +- roles/health-docker/tasks/main.yml | 6 ++--- .../templates/health-docker.service.j2 | 2 +- .../templates/health-docker.timer.j2 | 2 +- roles/health-docker/vars/main.yml | 2 +- roles/health-journalctl/tasks/main.yml | 6 ++--- .../templates/health-journalctl.service.j2 | 2 +- .../templates/health-journalctl.timer.j2 | 2 +- roles/health-journalctl/vars/main.yml | 2 +- roles/health-nginx/tasks/main.yml | 6 ++--- .../templates/health-nginx.service.j2 | 2 +- .../templates/health-nginx.timer.j2 | 2 +- roles/health-nginx/vars/main.yml | 2 +- 47 files changed, 87 insertions(+), 87 deletions(-) diff --git a/group_vars/all b/group_vars/all index 985dd627..e10cb9df 100644 --- a/group_vars/all +++ b/group_vars/all @@ -4,17 +4,17 @@ randomized_delay_sec: "15min" -on_calendar_btrfs_health_check: "*-*-* 00:00:00" -on_calendar_journalctl_health_check: "*-*-* 00:00:00" -on_calendar_disc_space_check: "*-*-* 06,12,18,00:00:00" -on_calendar_docker_health_check: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:00:00" -on_calendar_nginx_health_check: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:15:00" +on_calendar_health_btrfs: "*-*-* 00:00:00" +on_calendar_health_journalctl: "*-*-* 00:00:00" +on_calendar_health_disc_space: "*-*-* 06,12,18,00:00:00" +on_calendar_health_docker: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:00:00" +on_calendar_health_nginx: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:15:00" -on_calendar_backups_cleanup: "*-*-* 06,12,18,00:30:00" -on_calendar_free_disc_space: "*-*-* 07,13,19,01:30:00" -on_calendar_docker_volume_backup: "*-*-* 03:30:00" -on_calendar_docker_compose_restart_unhealthy: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01:30:00" -on_calendar_pull_primary_backups: "*-*-* 21:30:00" +on_calendar_cleanup_backups: "*-*-* 06,12,18,00:30:00" +on_calendar_cleanup_disc_space: "*-*-* 07,13,19,01:30:00" +on_calendar_backup_docker_to_local: "*-*-* 03:30:00" +on_calendar_backup_remote_to_local: "*-*-* 21:30:00" +on_calendar_heal_docker: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01:30:00" on_calendar_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00" on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00" on_calendar_msi_keyboard_color: "*-*-* *:*:00" @@ -22,7 +22,7 @@ on_calendar_msi_keyboard_color: "*-*-* *:*:00" # Space Variables size_percent_maximum_backup: 75 size_percent_disc_space_warning: 85 -size_percent_free_disc_space: 90 +size_percent_cleanup_disc_space: 90 # Path Variables path_administrator_home: "/home/administrator/" diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index f6e1cbea..c765b65c 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -8,7 +8,7 @@ - name: pull backup-docker-to-local.git git: repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git" - dest: "{{docker_volume_backup_folder}}" + dest: "{{backup_docker_to_local_folder}}" update: yes register: git_result ignore_errors: true @@ -30,9 +30,9 @@ changed_when: backup_docker_to_local_timer.changed or activate_all_timers | default(false) | bool notify: restart backup-docker-to-local.timer -- name: create {{docker_volume_backup_folder}}databases.csv +- name: create {{backup_docker_to_local_folder}}databases.csv copy: - src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{docker_volume_backup_folder}}databases.csv" - dest: "{{docker_volume_backup_folder}}databases.csv" + src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{backup_docker_to_local_folder}}databases.csv" + dest: "{{backup_docker_to_local_folder}}databases.csv" owner: root group: root diff --git a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 index 1a7fe128..a1382dca 100644 --- a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 +++ b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot -ExecStart=/usr/bin/python {{docker_volume_backup_folder}}backup-docker-to-local.py \ No newline at end of file +ExecStart=/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py \ No newline at end of file diff --git a/roles/backup-docker-to-local/templates/backup-docker-to-local.timer.j2 b/roles/backup-docker-to-local/templates/backup-docker-to-local.timer.j2 index 73e50e24..c7e4d75c 100644 --- a/roles/backup-docker-to-local/templates/backup-docker-to-local.timer.j2 +++ b/roles/backup-docker-to-local/templates/backup-docker-to-local.timer.j2 @@ -2,7 +2,7 @@ Description=backups the docker volumes [Timer] -OnCalendar={{on_calendar_docker_volume_backup}} +OnCalendar={{on_calendar_backup_docker_to_local}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/backup-docker-to-local/vars/main.yml b/roles/backup-docker-to-local/vars/main.yml index 9bedb65e..a12d9b3d 100644 --- a/roles/backup-docker-to-local/vars/main.yml +++ b/roles/backup-docker-to-local/vars/main.yml @@ -1 +1 @@ -docker_volume_backup_folder: "{{path_administrator_scripts}}backup-docker-to-local/" \ No newline at end of file +backup_docker_to_local_folder: "{{path_administrator_scripts}}backup-docker-to-local/" \ No newline at end of file diff --git a/roles/backup-remote-to-local/tasks/main.yml b/roles/backup-remote-to-local/tasks/main.yml index b2ef141d..94cce452 100644 --- a/roles/backup-remote-to-local/tasks/main.yml +++ b/roles/backup-remote-to-local/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{docker_pull_primary_backups_folder}}" +- name: "create {{docker_backup_remote_to_local_folder}}" file: - path: "{{docker_pull_primary_backups_folder}}" + path: "{{docker_backup_remote_to_local_folder}}" state: directory mode: 0755 - name: create backup-remote-to-local.sh copy: src: backup-remote-to-local.sh - dest: "{{docker_pull_primary_backups_folder}}backup-remote-to-local.sh" + dest: "{{docker_backup_remote_to_local_folder}}backup-remote-to-local.sh" mode: 0755 - name: create backup-remote-to-local.service @@ -16,13 +16,13 @@ - name: create backup-remote-to-local.timer template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer - register: backup_remote_to_local_timer - changed_when: backup_remote_to_local_timer.changed or activate_all_timers | default(false) | bool + register: backup_backup_remote_to_local_timer + changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers | default(false) | bool notify: restart backup-remote-to-local timer - name: create backup-remote-to-local.sh template: src: backup-remote-to-local.sh.j2 - dest: "{{docker_pull_primary_backups_folder}}backup-remote-to-local.sh" + dest: "{{docker_backup_remote_to_local_folder}}backup-remote-to-local.sh" mode: 0755 diff --git a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 index b3ce0da6..5dec08f6 100644 --- a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot -ExecStart=/usr/bin/bash {{docker_pull_primary_backups_folder}}backup-remote-to-local.sh +ExecStart=/usr/bin/bash {{docker_backup_remote_to_local_folder}}backup-remote-to-local.sh diff --git a/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 index 3f51fdfc..facae816 100644 --- a/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 @@ -3,6 +3,6 @@ hosts="{{pull_remote_backups}}"; errors=0 for host in $hosts; do - bash {{docker_pull_primary_backups_folder}}backup-remote-to-local.sh $host || ((errors+=1)); + bash {{docker_backup_remote_to_local_folder}}backup-remote-to-local.sh $host || ((errors+=1)); done; exit $errors; diff --git a/roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 index e2c3b5e0..666c21ff 100644 --- a/roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 @@ -2,7 +2,7 @@ Description=starts pull remote backup timer [Timer] -OnCalendar={{on_calendar_pull_primary_backups}} +OnCalendar={{on_calendar_backup_remote_to_local}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/backup-remote-to-local/vars/main.yml b/roles/backup-remote-to-local/vars/main.yml index e6bd36fe..d0744c9b 100644 --- a/roles/backup-remote-to-local/vars/main.yml +++ b/roles/backup-remote-to-local/vars/main.yml @@ -1 +1 @@ -docker_pull_primary_backups_folder: "{{path_administrator_scripts}}pull-primary-backups/" \ No newline at end of file +docker_backup_remote_to_local_folder: "{{path_administrator_scripts}}pull-primary-backups/" \ No newline at end of file diff --git a/roles/cleanup-backups-service/tasks/main.yml b/roles/cleanup-backups-service/tasks/main.yml index 749614cb..190adb62 100644 --- a/roles/cleanup-backups-service/tasks/main.yml +++ b/roles/cleanup-backups-service/tasks/main.yml @@ -5,16 +5,16 @@ - python-psutil state: present -- name: "create {{docker_backups_cleanup}}" +- name: "create {{docker_cleanup_backups}}" file: - path: "{{docker_backups_cleanup}}" + path: "{{docker_cleanup_backups}}" state: directory mode: 0755 - name: create cleanup-backups.py copy: src: "cleanup-backups.py" - dest: "{{docker_backups_cleanup}}cleanup-backups.py" + dest: "{{docker_cleanup_backups}}cleanup-backups.py" - name: create cleanup-backups.service template: diff --git a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 index 6126e6fe..cd900658 100644 --- a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 +++ b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/usr/bin/python {{docker_backups_cleanup}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} +ExecStart=/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} diff --git a/roles/cleanup-backups-service/vars/main.yml b/roles/cleanup-backups-service/vars/main.yml index 0ae8bf12..08281e14 100644 --- a/roles/cleanup-backups-service/vars/main.yml +++ b/roles/cleanup-backups-service/vars/main.yml @@ -1 +1 @@ -docker_backups_cleanup: "{{path_administrator_scripts}}cleanup-backups/" \ No newline at end of file +docker_cleanup_backups: "{{path_administrator_scripts}}cleanup-backups/" \ No newline at end of file diff --git a/roles/cleanup-backups-timer/templates/cleanup-backups.timer.j2 b/roles/cleanup-backups-timer/templates/cleanup-backups.timer.j2 index e3ef8fcf..7a68add0 100644 --- a/roles/cleanup-backups-timer/templates/cleanup-backups.timer.j2 +++ b/roles/cleanup-backups-timer/templates/cleanup-backups.timer.j2 @@ -2,7 +2,7 @@ Description=starts cleanup-backups.service [Timer] -OnCalendar={{on_calendar_backups_cleanup}} +OnCalendar={{on_calendar_cleanup_backups}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=true diff --git a/roles/cleanup-disc-space/tasks/main.yml b/roles/cleanup-disc-space/tasks/main.yml index 9a26c558..e52d413f 100644 --- a/roles/cleanup-disc-space/tasks/main.yml +++ b/roles/cleanup-disc-space/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{free_disc_space_folder}}" +- name: "create {{cleanup_disc_space_folder}}" file: - path: "{{free_disc_space_folder}}" + path: "{{cleanup_disc_space_folder}}" state: directory mode: 0755 - name: create cleanup-disc-space.sh template: src: cleanup-disc-space.sh.j2 - dest: "{{free_disc_space_folder}}cleanup-disc-space.sh" + dest: "{{cleanup_disc_space_folder}}cleanup-disc-space.sh" - name: create cleanup-disc-space.service template: diff --git a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 index 47e4c0a4..afd1e27b 100644 --- a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 +++ b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{free_disc_space_folder}}cleanup-disc-space.sh {{size_percent_free_disc_space}} \ No newline at end of file +ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}} \ No newline at end of file diff --git a/roles/cleanup-disc-space/templates/cleanup-disc-space.sh.j2 b/roles/cleanup-disc-space/templates/cleanup-disc-space.sh.j2 index 319828ff..c4c02311 100644 --- a/roles/cleanup-disc-space/templates/cleanup-disc-space.sh.j2 +++ b/roles/cleanup-disc-space/templates/cleanup-disc-space.sh.j2 @@ -2,8 +2,8 @@ # @param $1 mimimum free disc space # @param $2 --force to for execution indepentend on how much disc space is free -execute_free_disc_space=0 -minimum_percent_free_disc_space="$1" +execute_cleanup_disc_space=0 +minimum_percent_cleanup_disc_space="$1" force_freeing=false echo "Checking free disc space..." df @@ -14,12 +14,12 @@ fi for disc_use_percent in $(df --output=pcent | sed 1d) do disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//") - if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ]; then + if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then echo "WARNING: $disc_use_percent_number exceeds the limit of {{size_percent_disc_space_warning}}%." - execute_free_disc_space+=1; + execute_cleanup_disc_space+=1; fi done -if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$force_freeing" = true ]; then +if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ] || [ "$force_freeing" = true ]; then echo "cleaning up /tmp" && find /tmp -type f -atime +10 -delete || exit 1 diff --git a/roles/cleanup-disc-space/templates/cleanup-disc-space.timer.j2 b/roles/cleanup-disc-space/templates/cleanup-disc-space.timer.j2 index 9295d05f..e367e3a7 100644 --- a/roles/cleanup-disc-space/templates/cleanup-disc-space.timer.j2 +++ b/roles/cleanup-disc-space/templates/cleanup-disc-space.timer.j2 @@ -2,7 +2,7 @@ Description=starts cleanup-disc-space.service [Timer] -OnCalendar={{on_calendar_free_disc_space}} +OnCalendar={{on_calendar_cleanup_disc_space}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=true diff --git a/roles/cleanup-disc-space/vars/main.yml b/roles/cleanup-disc-space/vars/main.yml index 020d45f5..7a6c1430 100644 --- a/roles/cleanup-disc-space/vars/main.yml +++ b/roles/cleanup-disc-space/vars/main.yml @@ -1 +1 @@ -free_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/" \ No newline at end of file +cleanup_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/" \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/tasks/main.yml b/roles/cleanup-failed-docker-backups/tasks/main.yml index 46292718..27b427c5 100644 --- a/roles/cleanup-failed-docker-backups/tasks/main.yml +++ b/roles/cleanup-failed-docker-backups/tasks/main.yml @@ -1,7 +1,7 @@ - name: pull cleanup-failed-docker-backups.git git: repo: "https://github.com/kevinveenbirkenbach/cleanup-failed-docker-backups.git" - dest: "{{docker_volume_backup_cleanup_folder}}" + dest: "{{backup_docker_to_local_cleanup_folder}}" update: yes register: git_result ignore_errors: true diff --git a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 index f069f5a7..9a255b44 100644 --- a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 +++ b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{docker_volume_backup_cleanup_folder}}cleanup.sh {{docker_volume_backup_cleanup_machine_id}} {{docker_volume_backup_cleanup_trigger_directory}}' \ No newline at end of file +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}}' \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/vars/main.yml b/roles/cleanup-failed-docker-backups/vars/main.yml index 233cb0bc..d39530f0 100644 --- a/roles/cleanup-failed-docker-backups/vars/main.yml +++ b/roles/cleanup-failed-docker-backups/vars/main.yml @@ -1 +1 @@ -docker_volume_backup_cleanup_folder: "{{path_administrator_scripts}}cleanup-failed-docker-backups/" \ No newline at end of file +backup_docker_to_local_cleanup_folder: "{{path_administrator_scripts}}cleanup-failed-docker-backups/" \ No newline at end of file diff --git a/roles/heal-docker/tasks/main.yml b/roles/heal-docker/tasks/main.yml index c6899d02..01f831d6 100644 --- a/roles/heal-docker/tasks/main.yml +++ b/roles/heal-docker/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{docker_compose_restart_unhealthy}}" +- name: "create {{heal_docker}}" file: - path: "{{docker_compose_restart_unhealthy}}" + path: "{{heal_docker}}" state: directory mode: 0755 - name: create heal-docker.py copy: src: heal-docker.py - dest: "{{docker_compose_restart_unhealthy}}heal-docker.py" + dest: "{{heal_docker}}heal-docker.py" - name: create heal-docker.service template: diff --git a/roles/heal-docker/templates/heal-docker.service.j2 b/roles/heal-docker/templates/heal-docker.service.j2 index c796a74b..443d19a7 100644 --- a/roles/heal-docker/templates/heal-docker.service.j2 +++ b/roles/heal-docker/templates/heal-docker.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/python {{docker_compose_restart_unhealthy}}heal-docker.py +ExecStart=/bin/python {{heal_docker}}heal-docker.py diff --git a/roles/heal-docker/templates/heal-docker.timer.j2 b/roles/heal-docker/templates/heal-docker.timer.j2 index 5003237c..b04d6c80 100644 --- a/roles/heal-docker/templates/heal-docker.timer.j2 +++ b/roles/heal-docker/templates/heal-docker.timer.j2 @@ -2,7 +2,7 @@ Description=starts heal-docker.service [Timer] -OnCalendar={{on_calendar_docker_compose_restart_unhealthy}} +OnCalendar={{on_calendar_heal_docker}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/heal-docker/vars/main.yml b/roles/heal-docker/vars/main.yml index e2244974..4f1d4841 100644 --- a/roles/heal-docker/vars/main.yml +++ b/roles/heal-docker/vars/main.yml @@ -1 +1 @@ -docker_compose_restart_unhealthy: "{{path_administrator_scripts}}heal-docker/" \ No newline at end of file +heal_docker: "{{path_administrator_scripts}}heal-docker/" \ No newline at end of file diff --git a/roles/health-btrfs/tasks/main.yml b/roles/health-btrfs/tasks/main.yml index 229869b9..6f251e27 100644 --- a/roles/health-btrfs/tasks/main.yml +++ b/roles/health-btrfs/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{docker_btrfs_health_check_folder}}" +- name: "create {{docker_health_btrfs_folder}}" file: - path: "{{docker_btrfs_health_check_folder}}" + path: "{{docker_health_btrfs_folder}}" state: directory mode: 0755 - name: create health-btrfs.sh copy: src: health-btrfs.sh - dest: "{{docker_btrfs_health_check_folder}}health-btrfs.sh" + dest: "{{docker_health_btrfs_folder}}health-btrfs.sh" - name: create health-btrfs.service template: diff --git a/roles/health-btrfs/templates/health-btrfs.service.j2 b/roles/health-btrfs/templates/health-btrfs.service.j2 index 6e26e74c..155877ea 100644 --- a/roles/health-btrfs/templates/health-btrfs.service.j2 +++ b/roles/health-btrfs/templates/health-btrfs.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{docker_btrfs_health_check_folder}}health-btrfs.sh +ExecStart=/bin/bash {{docker_health_btrfs_folder}}health-btrfs.sh diff --git a/roles/health-btrfs/templates/health-btrfs.timer.j2 b/roles/health-btrfs/templates/health-btrfs.timer.j2 index 183ad383..787caaeb 100644 --- a/roles/health-btrfs/templates/health-btrfs.timer.j2 +++ b/roles/health-btrfs/templates/health-btrfs.timer.j2 @@ -2,7 +2,7 @@ Description=starts health-btrfs.service [Timer] -OnCalendar={{on_calendar_btrfs_health_check}} +OnCalendar={{on_calendar_health_btrfs}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/health-btrfs/vars/main.yml b/roles/health-btrfs/vars/main.yml index 94cab36e..a8e58764 100644 --- a/roles/health-btrfs/vars/main.yml +++ b/roles/health-btrfs/vars/main.yml @@ -1 +1 @@ -docker_btrfs_health_check_folder: "{{path_administrator_scripts}}health-btrfs/" \ No newline at end of file +docker_health_btrfs_folder: "{{path_administrator_scripts}}health-btrfs/" \ No newline at end of file diff --git a/roles/health-disc-space/files/health-disc-space.sh b/roles/health-disc-space/files/health-disc-space.sh index b0f930c3..efb0fdab 100644 --- a/roles/health-disc-space/files/health-disc-space.sh +++ b/roles/health-disc-space/files/health-disc-space.sh @@ -1,14 +1,14 @@ #!/bin/sh # @param $1 mimimum free disc space errors=0 -minimum_percent_free_disc_space="$1" +minimum_percent_cleanup_disc_space="$1" echo "checking disc space use..." df for disc_use_percent in $(df --output=pcent | sed 1d) do disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//") - if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ]; then - echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_free_disc_space%." + if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then + echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_cleanup_disc_space%." errors+=1; fi done diff --git a/roles/health-disc-space/tasks/main.yml b/roles/health-disc-space/tasks/main.yml index ddab22e1..500cf092 100644 --- a/roles/health-disc-space/tasks/main.yml +++ b/roles/health-disc-space/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{disc_space_check_folder}}" +- name: "create {{health_disc_space_folder}}" file: - path: "{{disc_space_check_folder}}" + path: "{{health_disc_space_folder}}" state: directory mode: 0755 - name: create health-disc-space.sh copy: src: health-disc-space.sh - dest: "{{disc_space_check_folder}}health-disc-space.sh" + dest: "{{health_disc_space_folder}}health-disc-space.sh" - name: create health-disc-space.service template: diff --git a/roles/health-disc-space/templates/health-disc-space.service.j2 b/roles/health-disc-space/templates/health-disc-space.service.j2 index d7b6a7f3..78203057 100644 --- a/roles/health-disc-space/templates/health-disc-space.service.j2 +++ b/roles/health-disc-space/templates/health-disc-space.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{disc_space_check_folder}}health-disc-space.sh {{size_percent_disc_space_warning}} +ExecStart=/bin/bash {{health_disc_space_folder}}health-disc-space.sh {{size_percent_disc_space_warning}} diff --git a/roles/health-disc-space/templates/health-disc-space.timer.j2 b/roles/health-disc-space/templates/health-disc-space.timer.j2 index 26fa71ab..916da0f7 100644 --- a/roles/health-disc-space/templates/health-disc-space.timer.j2 +++ b/roles/health-disc-space/templates/health-disc-space.timer.j2 @@ -2,7 +2,7 @@ Description=starts health-disc-space.service [Timer] -OnCalendar={{on_calendar_disc_space_check}} +OnCalendar={{on_calendar_health_disc_space}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=true diff --git a/roles/health-disc-space/vars/main.yml b/roles/health-disc-space/vars/main.yml index 1dd7537c..32940da5 100644 --- a/roles/health-disc-space/vars/main.yml +++ b/roles/health-disc-space/vars/main.yml @@ -1 +1 @@ -disc_space_check_folder: "{{path_administrator_scripts}}health-disc-space/" \ No newline at end of file +health_disc_space_folder: "{{path_administrator_scripts}}health-disc-space/" \ No newline at end of file diff --git a/roles/health-docker/tasks/main.yml b/roles/health-docker/tasks/main.yml index 492ed0a6..a85a4e0b 100644 --- a/roles/health-docker/tasks/main.yml +++ b/roles/health-docker/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{docker_health_check_folder}}" +- name: "create {{health_docker_folder}}" file: - path: "{{docker_health_check_folder}}" + path: "{{health_docker_folder}}" state: directory mode: 0755 - name: create health-docker.sh copy: src: health-docker.sh - dest: "{{docker_health_check_folder}}health-docker.sh" + dest: "{{health_docker_folder}}health-docker.sh" - name: create health-docker.service template: src=health-docker.service.j2 dest=/etc/systemd/system/health-docker.service diff --git a/roles/health-docker/templates/health-docker.service.j2 b/roles/health-docker/templates/health-docker.service.j2 index 92edad53..3fefbcbd 100644 --- a/roles/health-docker/templates/health-docker.service.j2 +++ b/roles/health-docker/templates/health-docker.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{docker_health_check_folder}}health-docker.sh +ExecStart=/bin/bash {{health_docker_folder}}health-docker.sh diff --git a/roles/health-docker/templates/health-docker.timer.j2 b/roles/health-docker/templates/health-docker.timer.j2 index 1749255e..9979c910 100644 --- a/roles/health-docker/templates/health-docker.timer.j2 +++ b/roles/health-docker/templates/health-docker.timer.j2 @@ -2,7 +2,7 @@ Description=starts health-docker.service [Timer] -OnCalendar={{on_calendar_docker_health_check}} +OnCalendar={{on_calendar_health_docker}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/health-docker/vars/main.yml b/roles/health-docker/vars/main.yml index 54de04d8..ab960b7d 100644 --- a/roles/health-docker/vars/main.yml +++ b/roles/health-docker/vars/main.yml @@ -1 +1 @@ -docker_health_check_folder: "{{path_administrator_scripts}}health-docker/" \ No newline at end of file +health_docker_folder: "{{path_administrator_scripts}}health-docker/" \ No newline at end of file diff --git a/roles/health-journalctl/tasks/main.yml b/roles/health-journalctl/tasks/main.yml index a8f21ae7..bac9878c 100644 --- a/roles/health-journalctl/tasks/main.yml +++ b/roles/health-journalctl/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{journalctl_health_check_folder}}" +- name: "create {{health_journalctl_folder}}" file: - path: "{{journalctl_health_check_folder}}" + path: "{{health_journalctl_folder}}" state: directory mode: 0755 - name: create health-journalctl.sh copy: src: health-journalctl.sh - dest: "{{journalctl_health_check_folder}}health-journalctl.sh" + dest: "{{health_journalctl_folder}}health-journalctl.sh" - name: create health-journalctl.service template: diff --git a/roles/health-journalctl/templates/health-journalctl.service.j2 b/roles/health-journalctl/templates/health-journalctl.service.j2 index 6e3a4bfa..c59e8706 100644 --- a/roles/health-journalctl/templates/health-journalctl.service.j2 +++ b/roles/health-journalctl/templates/health-journalctl.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{journalctl_health_check_folder}}health-journalctl.sh +ExecStart=/bin/bash {{health_journalctl_folder}}health-journalctl.sh diff --git a/roles/health-journalctl/templates/health-journalctl.timer.j2 b/roles/health-journalctl/templates/health-journalctl.timer.j2 index 5cd7ce6e..2a761db7 100644 --- a/roles/health-journalctl/templates/health-journalctl.timer.j2 +++ b/roles/health-journalctl/templates/health-journalctl.timer.j2 @@ -2,7 +2,7 @@ Description=starts health-journalctl.service [Timer] -OnCalendar={{on_calendar_journalctl_health_check}} +OnCalendar={{on_calendar_health_journalctl}} RandomizedDelaySec={{randomized_delay_sec}} Persistent=false diff --git a/roles/health-journalctl/vars/main.yml b/roles/health-journalctl/vars/main.yml index 2a700cac..559a6f4d 100644 --- a/roles/health-journalctl/vars/main.yml +++ b/roles/health-journalctl/vars/main.yml @@ -1 +1 @@ -journalctl_health_check_folder: "{{path_administrator_scripts}}health-journalctl/" \ No newline at end of file +health_journalctl_folder: "{{path_administrator_scripts}}health-journalctl/" \ No newline at end of file diff --git a/roles/health-nginx/tasks/main.yml b/roles/health-nginx/tasks/main.yml index fa1a2260..b3b7994b 100644 --- a/roles/health-nginx/tasks/main.yml +++ b/roles/health-nginx/tasks/main.yml @@ -3,16 +3,16 @@ name: python-requests state: present -- name: "create {{ nginx_health_check_folder }}" +- name: "create {{ health_nginx_folder }}" file: - path: "{{ nginx_health_check_folder }}" + path: "{{ health_nginx_folder }}" state: directory mode: 0755 - name: create health-nginx.py copy: src: health-nginx.py - dest: "{{ nginx_health_check_folder }}health-nginx.py" + dest: "{{ health_nginx_folder }}health-nginx.py" - name: create health-nginx.service template: diff --git a/roles/health-nginx/templates/health-nginx.service.j2 b/roles/health-nginx/templates/health-nginx.service.j2 index 04a428b3..e17335ed 100644 --- a/roles/health-nginx/templates/health-nginx.service.j2 +++ b/roles/health-nginx/templates/health-nginx.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/usr/bin/python3 {{ nginx_health_check_folder }}health-nginx.py +ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py diff --git a/roles/health-nginx/templates/health-nginx.timer.j2 b/roles/health-nginx/templates/health-nginx.timer.j2 index 6d97f573..7daefd52 100644 --- a/roles/health-nginx/templates/health-nginx.timer.j2 +++ b/roles/health-nginx/templates/health-nginx.timer.j2 @@ -2,7 +2,7 @@ Description=starts health-nginx.service [Timer] -OnCalendar={{ on_calendar_nginx_health_check }} +OnCalendar={{ on_calendar_health_nginx }} RandomizedDelaySec={{ randomized_delay_sec }} Persistent=false diff --git a/roles/health-nginx/vars/main.yml b/roles/health-nginx/vars/main.yml index 4b0dfe4c..8b4c5140 100644 --- a/roles/health-nginx/vars/main.yml +++ b/roles/health-nginx/vars/main.yml @@ -1 +1 @@ -nginx_health_check_folder: "{{ path_administrator_scripts }}health-nginx/" +health_nginx_folder: "{{ path_administrator_scripts }}health-nginx/"