Implemented -e "activate_all_timers=true"

This commit is contained in:
Kevin Veen-Birkenbach 2023-11-16 19:43:54 +01:00
parent 333d1078f8
commit 29f134005f
20 changed files with 42 additions and 20 deletions

View File

@ -5,7 +5,7 @@ OnFailure=systemd-notifier@%n.service
[Service]
ExecStart=/bin/python {{ backup_to_usb_script_path }} {{backup_to_usb_source}} {{backup_to_usb_destination}}
ExecStartPost=/bin/systemctl start backups-cleanup.service
ExecStartPost=/bin/systemctl start cleanup-backups.service
[Install]
WantedBy=multi-user.target

View File

@ -26,6 +26,8 @@
- name: configure backup-docker-to-local.timer.tpl
template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer
register: backup_docker_to_local_timer
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

View File

@ -16,6 +16,8 @@
- 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
notify: restart backup-remote-to-local timer
- name: create backup-remote-to-local.sh

View File

@ -13,4 +13,6 @@
template:
src: certbot.timer.j2
dest: /etc/systemd/system/certbot.timer
register: certbot_timer
changed_when: certbot_timer.changed or activate_all_timers | default(false) | bool
notify: restart certbot timer

View File

@ -1,6 +1,6 @@
- name: "reload backups-cleanup.service"
- name: "reload cleanup-backups.service"
systemd:
name: backups-cleanup.service
name: cleanup-backups.service
state: reloaded
enabled: yes
daemon_reload: yes

View File

@ -11,13 +11,13 @@
state: directory
mode: 0755
- name: create backups-cleanup.py
- name: create cleanup-backups.py
copy:
src: "backups-cleanup.py"
dest: "{{docker_backups_cleanup}}backups-cleanup.py"
src: "cleanup-backups.py"
dest: "{{docker_backups_cleanup}}cleanup-backups.py"
- name: create backups-cleanup.service
- name: create cleanup-backups.service
template:
src: "backups-cleanup.service.j2"
dest: "/etc/systemd/system/backups-cleanup.service"
notify: reload backups-cleanup.service
src: "cleanup-backups.service.j2"
dest: "/etc/systemd/system/cleanup-backups.service"
notify: reload cleanup-backups.service

View File

@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python {{docker_backups_cleanup}}backups-cleanup.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}
ExecStart=/usr/bin/python {{docker_backups_cleanup}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}

View File

@ -1 +1 @@
docker_backups_cleanup: "{{path_administrator_scripts}}backups-cleanup/"
docker_backups_cleanup: "{{path_administrator_scripts}}cleanup-backups/"

View File

@ -1,6 +1,6 @@
- name: "restart backups-cleanup.timer"
- name: "restart cleanup-backups.timer"
systemd:
name: backups-cleanup.timer
name: cleanup-backups.timer
state: restarted
enabled: yes
daemon_reload: yes

View File

@ -1,5 +1,7 @@
- name: create backups-cleanup.timer
- name: create cleanup-backups.timer
template:
src: "backups-cleanup.timer.j2"
dest: "/etc/systemd/system/backups-cleanup.timer"
notify: restart backups-cleanup.timer
src: "cleanup-backups.timer.j2"
dest: "/etc/systemd/system/cleanup-backups.timer"
register: cleanup_backups_timer
changed_when: cleanup_backups_timer.changed or activate_all_timers | default(false) | bool
notify: restart cleanup-backups.timer

View File

@ -1,5 +1,5 @@
[Unit]
Description=starts backups-cleanup.service
Description=starts cleanup-backups.service
[Timer]
OnCalendar={{on_calendar_backups_cleanup}}

View File

@ -19,4 +19,6 @@
template:
src: cleanup-disc-space.timer.j2
dest: /etc/systemd/system/cleanup-disc-space.timer
register: cleanup_disc_space_timer
changed_when: cleanup_disc_space_timer.changed or activate_all_timers | default(false) | bool
notify: restart cleanup-disc-space.timer

View File

@ -25,7 +25,7 @@ if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$
{% if backups_folder_path is defined and size_percent_maximum_backup is defined %}
echo "cleaning up backups" &&
python {{path_administrator_scripts}}backups-cleanup/backups-cleanup.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} || exit 2
python {{path_administrator_scripts}}cleanup-backups/cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} || exit 2
{% endif %}
if pacman -Qs $package > /dev/null ; then

View File

@ -60,4 +60,6 @@
template:
src: "deploy-letsencrypt-mailu.timer.j2"
dest: "/etc/systemd/system/deploy-letsencrypt-mailu.timer"
register: deploy_letsencrypt_mailu_timer
changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers | default(false) | bool
notify: restart deploy-letsencrypt-mailu.timer

View File

@ -19,4 +19,6 @@
template:
src: heal-docker.timer.j2
dest: "/etc/systemd/system/heal-docker.timer"
register: heal_docker_timer
changed_when: heal_docker_timer.changed or activate_all_timers | default(false) | bool
notify: restart heal-docker.timer

View File

@ -19,4 +19,6 @@
template:
src: health-btrfs.timer.j2
dest: "/etc/systemd/system/health-btrfs.timer"
register: health_btrs_timer
changed_when: health_btrs_timer.changed or activate_all_timers | default(false) | bool
notify: restart health-btrfs.timer

View File

@ -19,4 +19,6 @@
template:
src: health-disc-space.timer.j2
dest: /etc/systemd/system/health-disc-space.timer
register: health_disc_space_timer
changed_when: health_disc_space_timer.changed or activate_all_timers | default(false) | bool
notify: restart health-disc-space.timer

View File

@ -17,4 +17,6 @@
template:
src: health-docker.timer.j2
dest: "/etc/systemd/system/health-docker.timer"
register: health_docker_timer
changed_when: health_docker_timer.changed or activate_all_timers | default(false) | bool
notify: restart health-docker.timer

View File

@ -19,4 +19,6 @@
template:
src: health-journalctl.timer.j2
dest: /etc/systemd/system/health-journalctl.timer
register: health_journalctl_timer
changed_when: health_journalctl_timer.changed or activate_all_timers | default(false) | bool
notify: restart health-journalctl.timer