mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
optimized variable names
This commit is contained in:
parent
6bc6f52f5c
commit
dfaa449989
@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
randomized_delay_sec: "15min"
|
randomized_delay_sec: "15min"
|
||||||
|
|
||||||
on_calendar_btrfs_health_check: "*-*-* 00:00:00"
|
on_calendar_health_btrfs: "*-*-* 00:00:00"
|
||||||
on_calendar_journalctl_health_check: "*-*-* 00:00:00"
|
on_calendar_health_journalctl: "*-*-* 00:00:00"
|
||||||
on_calendar_disc_space_check: "*-*-* 06,12,18,00:00:00"
|
on_calendar_health_disc_space: "*-*-* 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_health_docker: "*-*-* 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_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_cleanup_backups: "*-*-* 06,12,18,00:30:00"
|
||||||
on_calendar_free_disc_space: "*-*-* 07,13,19,01:30:00"
|
on_calendar_cleanup_disc_space: "*-*-* 07,13,19,01:30:00"
|
||||||
on_calendar_docker_volume_backup: "*-*-* 03:30:00"
|
on_calendar_backup_docker_to_local: "*-*-* 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_backup_remote_to_local: "*-*-* 21:30:00"
|
||||||
on_calendar_pull_primary_backups: "*-*-* 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_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00"
|
||||||
on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00"
|
on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00"
|
||||||
on_calendar_msi_keyboard_color: "*-*-* *:*:00"
|
on_calendar_msi_keyboard_color: "*-*-* *:*:00"
|
||||||
@ -22,7 +22,7 @@ on_calendar_msi_keyboard_color: "*-*-* *:*:00"
|
|||||||
# Space Variables
|
# Space Variables
|
||||||
size_percent_maximum_backup: 75
|
size_percent_maximum_backup: 75
|
||||||
size_percent_disc_space_warning: 85
|
size_percent_disc_space_warning: 85
|
||||||
size_percent_free_disc_space: 90
|
size_percent_cleanup_disc_space: 90
|
||||||
|
|
||||||
# Path Variables
|
# Path Variables
|
||||||
path_administrator_home: "/home/administrator/"
|
path_administrator_home: "/home/administrator/"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
- name: pull backup-docker-to-local.git
|
- name: pull backup-docker-to-local.git
|
||||||
git:
|
git:
|
||||||
repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git"
|
repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git"
|
||||||
dest: "{{docker_volume_backup_folder}}"
|
dest: "{{backup_docker_to_local_folder}}"
|
||||||
update: yes
|
update: yes
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@ -30,9 +30,9 @@
|
|||||||
changed_when: backup_docker_to_local_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: backup_docker_to_local_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart backup-docker-to-local.timer
|
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:
|
copy:
|
||||||
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{docker_volume_backup_folder}}databases.csv"
|
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{backup_docker_to_local_folder}}databases.csv"
|
||||||
dest: "{{docker_volume_backup_folder}}databases.csv"
|
dest: "{{backup_docker_to_local_folder}}databases.csv"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/python {{docker_volume_backup_folder}}backup-docker-to-local.py
|
ExecStart=/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py
|
@ -2,7 +2,7 @@
|
|||||||
Description=backups the docker volumes
|
Description=backups the docker volumes
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_docker_volume_backup}}
|
OnCalendar={{on_calendar_backup_docker_to_local}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_volume_backup_folder: "{{path_administrator_scripts}}backup-docker-to-local/"
|
backup_docker_to_local_folder: "{{path_administrator_scripts}}backup-docker-to-local/"
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{docker_pull_primary_backups_folder}}"
|
- name: "create {{docker_backup_remote_to_local_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_pull_primary_backups_folder}}"
|
path: "{{docker_backup_remote_to_local_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create backup-remote-to-local.sh
|
- name: create backup-remote-to-local.sh
|
||||||
copy:
|
copy:
|
||||||
src: backup-remote-to-local.sh
|
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
|
mode: 0755
|
||||||
|
|
||||||
- name: create backup-remote-to-local.service
|
- name: create backup-remote-to-local.service
|
||||||
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
- name: create backup-remote-to-local.timer
|
- name: create backup-remote-to-local.timer
|
||||||
template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/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
|
register: backup_backup_remote_to_local_timer
|
||||||
changed_when: backup_remote_to_local_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart backup-remote-to-local timer
|
notify: restart backup-remote-to-local timer
|
||||||
|
|
||||||
- name: create backup-remote-to-local.sh
|
- name: create backup-remote-to-local.sh
|
||||||
template:
|
template:
|
||||||
src: backup-remote-to-local.sh.j2
|
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
|
mode: 0755
|
||||||
|
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
hosts="{{pull_remote_backups}}";
|
hosts="{{pull_remote_backups}}";
|
||||||
errors=0
|
errors=0
|
||||||
for host in $hosts; do
|
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;
|
done;
|
||||||
exit $errors;
|
exit $errors;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts pull remote backup timer
|
Description=starts pull remote backup timer
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_pull_primary_backups}}
|
OnCalendar={{on_calendar_backup_remote_to_local}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_pull_primary_backups_folder: "{{path_administrator_scripts}}pull-primary-backups/"
|
docker_backup_remote_to_local_folder: "{{path_administrator_scripts}}pull-primary-backups/"
|
@ -5,16 +5,16 @@
|
|||||||
- python-psutil
|
- python-psutil
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "create {{docker_backups_cleanup}}"
|
- name: "create {{docker_cleanup_backups}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_backups_cleanup}}"
|
path: "{{docker_cleanup_backups}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create cleanup-backups.py
|
- name: create cleanup-backups.py
|
||||||
copy:
|
copy:
|
||||||
src: "cleanup-backups.py"
|
src: "cleanup-backups.py"
|
||||||
dest: "{{docker_backups_cleanup}}cleanup-backups.py"
|
dest: "{{docker_cleanup_backups}}cleanup-backups.py"
|
||||||
|
|
||||||
- name: create cleanup-backups.service
|
- name: create cleanup-backups.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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}}
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_backups_cleanup: "{{path_administrator_scripts}}cleanup-backups/"
|
docker_cleanup_backups: "{{path_administrator_scripts}}cleanup-backups/"
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts cleanup-backups.service
|
Description=starts cleanup-backups.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_backups_cleanup}}
|
OnCalendar={{on_calendar_cleanup_backups}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=true
|
Persistent=true
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{free_disc_space_folder}}"
|
- name: "create {{cleanup_disc_space_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{free_disc_space_folder}}"
|
path: "{{cleanup_disc_space_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create cleanup-disc-space.sh
|
- name: create cleanup-disc-space.sh
|
||||||
template:
|
template:
|
||||||
src: cleanup-disc-space.sh.j2
|
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
|
- name: create cleanup-disc-space.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash {{free_disc_space_folder}}cleanup-disc-space.sh {{size_percent_free_disc_space}}
|
ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}
|
@ -2,8 +2,8 @@
|
|||||||
# @param $1 mimimum free disc space
|
# @param $1 mimimum free disc space
|
||||||
# @param $2 --force to for execution indepentend on how much disc space is free
|
# @param $2 --force to for execution indepentend on how much disc space is free
|
||||||
|
|
||||||
execute_free_disc_space=0
|
execute_cleanup_disc_space=0
|
||||||
minimum_percent_free_disc_space="$1"
|
minimum_percent_cleanup_disc_space="$1"
|
||||||
force_freeing=false
|
force_freeing=false
|
||||||
echo "Checking free disc space..."
|
echo "Checking free disc space..."
|
||||||
df
|
df
|
||||||
@ -14,12 +14,12 @@ fi
|
|||||||
for disc_use_percent in $(df --output=pcent | sed 1d)
|
for disc_use_percent in $(df --output=pcent | sed 1d)
|
||||||
do
|
do
|
||||||
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
|
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}}%."
|
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
|
fi
|
||||||
done
|
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" &&
|
echo "cleaning up /tmp" &&
|
||||||
find /tmp -type f -atime +10 -delete || exit 1
|
find /tmp -type f -atime +10 -delete || exit 1
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts cleanup-disc-space.service
|
Description=starts cleanup-disc-space.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_free_disc_space}}
|
OnCalendar={{on_calendar_cleanup_disc_space}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=true
|
Persistent=true
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
free_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/"
|
cleanup_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/"
|
@ -1,7 +1,7 @@
|
|||||||
- name: pull cleanup-failed-docker-backups.git
|
- name: pull cleanup-failed-docker-backups.git
|
||||||
git:
|
git:
|
||||||
repo: "https://github.com/kevinveenbirkenbach/cleanup-failed-docker-backups.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
|
update: yes
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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}}'
|
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}}'
|
@ -1 +1 @@
|
|||||||
docker_volume_backup_cleanup_folder: "{{path_administrator_scripts}}cleanup-failed-docker-backups/"
|
backup_docker_to_local_cleanup_folder: "{{path_administrator_scripts}}cleanup-failed-docker-backups/"
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{docker_compose_restart_unhealthy}}"
|
- name: "create {{heal_docker}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_compose_restart_unhealthy}}"
|
path: "{{heal_docker}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create heal-docker.py
|
- name: create heal-docker.py
|
||||||
copy:
|
copy:
|
||||||
src: heal-docker.py
|
src: heal-docker.py
|
||||||
dest: "{{docker_compose_restart_unhealthy}}heal-docker.py"
|
dest: "{{heal_docker}}heal-docker.py"
|
||||||
|
|
||||||
- name: create heal-docker.service
|
- name: create heal-docker.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/python {{docker_compose_restart_unhealthy}}heal-docker.py
|
ExecStart=/bin/python {{heal_docker}}heal-docker.py
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts heal-docker.service
|
Description=starts heal-docker.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_docker_compose_restart_unhealthy}}
|
OnCalendar={{on_calendar_heal_docker}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_compose_restart_unhealthy: "{{path_administrator_scripts}}heal-docker/"
|
heal_docker: "{{path_administrator_scripts}}heal-docker/"
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{docker_btrfs_health_check_folder}}"
|
- name: "create {{docker_health_btrfs_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_btrfs_health_check_folder}}"
|
path: "{{docker_health_btrfs_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create health-btrfs.sh
|
- name: create health-btrfs.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-btrfs.sh
|
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
|
- name: create health-btrfs.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash {{docker_btrfs_health_check_folder}}health-btrfs.sh
|
ExecStart=/bin/bash {{docker_health_btrfs_folder}}health-btrfs.sh
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts health-btrfs.service
|
Description=starts health-btrfs.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_btrfs_health_check}}
|
OnCalendar={{on_calendar_health_btrfs}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_btrfs_health_check_folder: "{{path_administrator_scripts}}health-btrfs/"
|
docker_health_btrfs_folder: "{{path_administrator_scripts}}health-btrfs/"
|
@ -1,14 +1,14 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# @param $1 mimimum free disc space
|
# @param $1 mimimum free disc space
|
||||||
errors=0
|
errors=0
|
||||||
minimum_percent_free_disc_space="$1"
|
minimum_percent_cleanup_disc_space="$1"
|
||||||
echo "checking disc space use..."
|
echo "checking disc space use..."
|
||||||
df
|
df
|
||||||
for disc_use_percent in $(df --output=pcent | sed 1d)
|
for disc_use_percent in $(df --output=pcent | sed 1d)
|
||||||
do
|
do
|
||||||
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
|
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 $minimum_percent_free_disc_space%."
|
echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_cleanup_disc_space%."
|
||||||
errors+=1;
|
errors+=1;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{disc_space_check_folder}}"
|
- name: "create {{health_disc_space_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{disc_space_check_folder}}"
|
path: "{{health_disc_space_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create health-disc-space.sh
|
- name: create health-disc-space.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-disc-space.sh
|
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
|
- name: create health-disc-space.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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}}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts health-disc-space.service
|
Description=starts health-disc-space.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_disc_space_check}}
|
OnCalendar={{on_calendar_health_disc_space}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=true
|
Persistent=true
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
disc_space_check_folder: "{{path_administrator_scripts}}health-disc-space/"
|
health_disc_space_folder: "{{path_administrator_scripts}}health-disc-space/"
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{docker_health_check_folder}}"
|
- name: "create {{health_docker_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_health_check_folder}}"
|
path: "{{health_docker_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create health-docker.sh
|
- name: create health-docker.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-docker.sh
|
src: health-docker.sh
|
||||||
dest: "{{docker_health_check_folder}}health-docker.sh"
|
dest: "{{health_docker_folder}}health-docker.sh"
|
||||||
|
|
||||||
- name: create health-docker.service
|
- name: create health-docker.service
|
||||||
template: src=health-docker.service.j2 dest=/etc/systemd/system/health-docker.service
|
template: src=health-docker.service.j2 dest=/etc/systemd/system/health-docker.service
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash {{docker_health_check_folder}}health-docker.sh
|
ExecStart=/bin/bash {{health_docker_folder}}health-docker.sh
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts health-docker.service
|
Description=starts health-docker.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_docker_health_check}}
|
OnCalendar={{on_calendar_health_docker}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
docker_health_check_folder: "{{path_administrator_scripts}}health-docker/"
|
health_docker_folder: "{{path_administrator_scripts}}health-docker/"
|
@ -1,13 +1,13 @@
|
|||||||
- name: "create {{journalctl_health_check_folder}}"
|
- name: "create {{health_journalctl_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{journalctl_health_check_folder}}"
|
path: "{{health_journalctl_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create health-journalctl.sh
|
- name: create health-journalctl.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-journalctl.sh
|
src: health-journalctl.sh
|
||||||
dest: "{{journalctl_health_check_folder}}health-journalctl.sh"
|
dest: "{{health_journalctl_folder}}health-journalctl.sh"
|
||||||
|
|
||||||
- name: create health-journalctl.service
|
- name: create health-journalctl.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash {{journalctl_health_check_folder}}health-journalctl.sh
|
ExecStart=/bin/bash {{health_journalctl_folder}}health-journalctl.sh
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts health-journalctl.service
|
Description=starts health-journalctl.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{on_calendar_journalctl_health_check}}
|
OnCalendar={{on_calendar_health_journalctl}}
|
||||||
RandomizedDelaySec={{randomized_delay_sec}}
|
RandomizedDelaySec={{randomized_delay_sec}}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
journalctl_health_check_folder: "{{path_administrator_scripts}}health-journalctl/"
|
health_journalctl_folder: "{{path_administrator_scripts}}health-journalctl/"
|
@ -3,16 +3,16 @@
|
|||||||
name: python-requests
|
name: python-requests
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "create {{ nginx_health_check_folder }}"
|
- name: "create {{ health_nginx_folder }}"
|
||||||
file:
|
file:
|
||||||
path: "{{ nginx_health_check_folder }}"
|
path: "{{ health_nginx_folder }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create health-nginx.py
|
- name: create health-nginx.py
|
||||||
copy:
|
copy:
|
||||||
src: health-nginx.py
|
src: health-nginx.py
|
||||||
dest: "{{ nginx_health_check_folder }}health-nginx.py"
|
dest: "{{ health_nginx_folder }}health-nginx.py"
|
||||||
|
|
||||||
- name: create health-nginx.service
|
- name: create health-nginx.service
|
||||||
template:
|
template:
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/python3 {{ nginx_health_check_folder }}health-nginx.py
|
ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=starts health-nginx.service
|
Description=starts health-nginx.service
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{ on_calendar_nginx_health_check }}
|
OnCalendar={{ on_calendar_health_nginx }}
|
||||||
RandomizedDelaySec={{ randomized_delay_sec }}
|
RandomizedDelaySec={{ randomized_delay_sec }}
|
||||||
Persistent=false
|
Persistent=false
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
nginx_health_check_folder: "{{ path_administrator_scripts }}health-nginx/"
|
health_nginx_folder: "{{ path_administrator_scripts }}health-nginx/"
|
||||||
|
Loading…
Reference in New Issue
Block a user