Implemented server tact

This commit is contained in:
Kevin Veen-Birkenbach 2023-04-15 17:06:10 +02:00
parent 0f7a2fcb9e
commit 9f0df846df
24 changed files with 60 additions and 44 deletions

10
group_vars/all Normal file
View File

@ -0,0 +1,10 @@
# Server Tact Variables
# @see https://man.archlinux.org/man/systemd.time.7
on_calendar_btrfs_health_check: "*-*-* 00:00:00"
on_calendar_journalctl_health_check: "*-*-* 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_backups_cleanup: "*-*-* 06,12,18,00: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"

View File

@ -60,7 +60,7 @@ How to manage users is described here: https://mailu.io/master/cli.html
### database access ### database access
To access the database execute To access the database execute
```bash ```bash
docker exec -it nextcloud_database_1 mysql -u nextcloud -D nextcloud -p docker exec -it mailu-database-1 mysql -u root -D mailu -p
``` ```
### mailu_front_1 ### mailu_front_1

View File

@ -1,2 +1 @@
mailu_front_container_name: "mailu-front-1" mailu_front_container_name: "mailu-front-1"
mailu_version: "1.9"

View File

@ -1,7 +1,7 @@
- name: "restart backups-cleanup.service" - name: "reload backups-cleanup.service"
systemd: systemd:
name: backups-cleanup.service name: backups-cleanup.service
state: restarted state: reloaded
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart backups-cleanup.timer" - name: "restart backups-cleanup.timer"

View File

@ -13,10 +13,10 @@
- name: create backups-cleanup.service - name: create backups-cleanup.service
template: src=backups-cleanup.service.j2 dest=/etc/systemd/system/backups-cleanup.service template: src=backups-cleanup.service.j2 dest=/etc/systemd/system/backups-cleanup.service
notify: restart backups-cleanup.service notify: reload backups-cleanup.service
- name: create backups-cleanup.timer - name: create backups-cleanup.timer
copy: template:
src: backups-cleanup.timer src: backups-cleanup.timer.j2
dest: "/etc/systemd/system/backups-cleanup.timer" dest: "/etc/systemd/system/backups-cleanup.timer"
notify: restart backups-cleanup.timer notify: restart backups-cleanup.timer

View File

@ -3,8 +3,7 @@ Description=starts backups-cleanup.service
[Timer] [Timer]
OnBootSec=1min OnBootSec=1min
OnUnitActiveSec=3h OnCalendar={{on_calendar_backups_cleanup}}
RandomizedDelaySec=1h
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,7 +1,7 @@
- name: "restart btrfs-health-check.service" - name: "reload btrfs-health-check.service"
systemd: systemd:
name: btrfs-health-check.service name: btrfs-health-check.service
state: restarted state: reloaded
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart btrfs-health-check.timer" - name: "restart btrfs-health-check.timer"

View File

@ -13,10 +13,10 @@
template: template:
src: btrfs-health-check.service.j2 src: btrfs-health-check.service.j2
dest: /etc/systemd/system/btrfs-health-check.service dest: /etc/systemd/system/btrfs-health-check.service
notify: restart btrfs-health-check.service notify: reload btrfs-health-check.service
- name: create btrfs-health-check.timer - name: create btrfs-health-check.timer
copy: template:
src: btrfs-health-check.timer src: btrfs-health-check.timer.j2
dest: "/etc/systemd/system/btrfs-health-check.timer" dest: "/etc/systemd/system/btrfs-health-check.timer"
notify: restart btrfs-health-check.timer notify: restart btrfs-health-check.timer

View File

@ -2,7 +2,7 @@
Description=starts btrfs-health-check.service Description=starts btrfs-health-check.service
[Timer] [Timer]
OnCalendar=12:00 OnCalendar={{on_calendar_btrfs_health_check}}
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,4 +1,4 @@
- name: "reloaded docker-compose-restart-unhealthy.service" - name: "reload docker-compose-restart-unhealthy.service"
systemd: systemd:
name: docker-compose-restart-unhealthy.service name: docker-compose-restart-unhealthy.service
state: reloaded state: reloaded

View File

@ -13,10 +13,10 @@
template: template:
src: docker-compose-restart-unhealthy.service.j2 src: docker-compose-restart-unhealthy.service.j2
dest: /etc/systemd/system/docker-compose-restart-unhealthy.service dest: /etc/systemd/system/docker-compose-restart-unhealthy.service
notify: reloaded docker-compose-restart-unhealthy.service notify: reload docker-compose-restart-unhealthy.service
- name: create docker-compose-restart-unhealthy.timer - name: create docker-compose-restart-unhealthy.timer
copy: template:
src: docker-compose-restart-unhealthy.timer src: docker-compose-restart-unhealthy.timer.j2
dest: "/etc/systemd/system/docker-compose-restart-unhealthy.timer" dest: "/etc/systemd/system/docker-compose-restart-unhealthy.timer"
notify: restart docker-compose-restart-unhealthy.timer notify: restart docker-compose-restart-unhealthy.timer

View File

@ -2,8 +2,7 @@
Description=starts docker-compose-restart-unhealthy.service Description=starts docker-compose-restart-unhealthy.service
[Timer] [Timer]
OnBootSec=1min OnCalendar={{on_calendar_docker_compose_restart_unhealthy}}
OnUnitActiveSec=1h
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,7 +1,7 @@
- name: "restart docker-health-check.service" - name: "reload docker-health-check.service"
systemd: systemd:
name: docker-health-check.service name: docker-health-check.service
state: restarted state: reloaded
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart docker-health-check.timer" - name: "restart docker-health-check.timer"

View File

@ -11,10 +11,10 @@
- name: create docker-health-check.service - name: create docker-health-check.service
template: src=docker-health-check.service.j2 dest=/etc/systemd/system/docker-health-check.service template: src=docker-health-check.service.j2 dest=/etc/systemd/system/docker-health-check.service
notify: restart docker-health-check.service notify: reload docker-health-check.service
- name: create docker-health-check.timer - name: create docker-health-check.timer
copy: template:
src: docker-health-check.timer src: docker-health-check.timer.j2
dest: "/etc/systemd/system/docker-health-check.timer" dest: "/etc/systemd/system/docker-health-check.timer"
notify: restart docker-health-check.timer notify: restart docker-health-check.timer

View File

@ -2,7 +2,7 @@
Description=starts docker-health-check.service Description=starts docker-health-check.service
[Timer] [Timer]
OnCalendar=10:00 OnCalendar={{on_calendar_docker_health_check}}
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,7 +1,7 @@
- name: "restart docker-volume-backup service" - name: "reload docker-volume-backup service"
systemd: systemd:
name: docker-volume-backup.service name: docker-volume-backup.service
state: restarted state: reloaded
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart docker-volume-backup timer" - name: "restart docker-volume-backup timer"

View File

@ -8,9 +8,11 @@
dest: "{{docker_volume_backup_folder}}" dest: "{{docker_volume_backup_folder}}"
update: yes update: yes
- name: configure docker-volume-backup.service.tpl - name: configure docker-volume-backup.service
template: src=docker-volume-backup.service.j2 dest=/etc/systemd/system/docker-volume-backup.service template:
notify: restart docker-volume-backup service src: docker-volume-backup.service.j2
dest: /etc/systemd/system/docker-volume-backup.service
notify: reload docker-volume-backup service
- name: configure docker-volume-backup.timer.tpl - name: configure docker-volume-backup.timer.tpl
template: src=docker-volume-backup.timer.j2 dest=/etc/systemd/system/docker-volume-backup.timer template: src=docker-volume-backup.timer.j2 dest=/etc/systemd/system/docker-volume-backup.timer

View File

@ -2,8 +2,7 @@
Description=backups the docker volumes Description=backups the docker volumes
[Timer] [Timer]
OnCalendar=3:00 OnCalendar={{on_calendar_docker_volume_backup}}
RandomizedDelaySec=1h
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,3 +1,9 @@
- name: "reload journalctl-health-check.service"
systemd:
name: journalctl-health-check.service
state: reloaded
enabled: yes
daemon_reload: yes
- name: "restart journalctl-health-check.timer" - name: "restart journalctl-health-check.timer"
systemd: systemd:
name: journalctl-health-check.timer name: journalctl-health-check.timer

View File

@ -10,10 +10,13 @@
dest: "{{journalctl_health_check_folder}}journalctl-health-check.sh" dest: "{{journalctl_health_check_folder}}journalctl-health-check.sh"
- name: create journalctl-health-check.service - name: create journalctl-health-check.service
template: src=journalctl-health-check.service.j2 dest=/etc/systemd/system/journalctl-health-check.service template:
src: journalctl-health-check.service.j2
dest: /etc/systemd/system/journalctl-health-check.service
notify: reload journalctl-health-check.service
- name: create journalctl-health-check.timer - name: create journalctl-health-check.timer
copy: template:
src: journalctl-health-check.timer src: journalctl-health-check.timer.j2
dest: "/etc/systemd/system/journalctl-health-check.timer" dest: /etc/systemd/system/journalctl-health-check.timer
notify: restart journalctl-health-check.timer notify: restart journalctl-health-check.timer

View File

@ -2,7 +2,7 @@
Description=starts journalctl-health-check.service Description=starts journalctl-health-check.service
[Timer] [Timer]
OnCalendar=00:00 OnCalendar={{on_calendar_journalctl_health_check}}
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View File

@ -1,7 +1,7 @@
- name: "restart pull-remote-backups service" - name: "reload pull-remote-backups service"
systemd: systemd:
name: pull-remote-backups.service name: pull-remote-backups.service
state: restarted state: reloaded
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart pull-remote-backups timer" - name: "restart pull-remote-backups timer"

View File

@ -12,7 +12,7 @@
- name: create pull-remote-backups.service - name: create pull-remote-backups.service
template: src=pull-remote-backups.service.j2 dest=/etc/systemd/system/pull-remote-backups.service template: src=pull-remote-backups.service.j2 dest=/etc/systemd/system/pull-remote-backups.service
notify: restart pull-remote-backups service notify: reload pull-remote-backups service
- name: create pull-remote-backups.timer - name: create pull-remote-backups.timer
template: src=pull-remote-backups.timer.j2 dest=/etc/systemd/system/pull-remote-backups.timer template: src=pull-remote-backups.timer.j2 dest=/etc/systemd/system/pull-remote-backups.timer

View File

@ -2,8 +2,7 @@
Description=starts pull remote backup timer Description=starts pull remote backup timer
[Timer] [Timer]
OnCalendar=22:00 OnCalendar={{on_calendar_pull_primary_backups}}
RandomizedDelaySec=1h
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target