From b793ebf587c062d763ec5d16c4162998223c38f0 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Sat, 25 Jan 2025 03:20:07 -0600 Subject: [PATCH] Make backups a ton, ton more betterer --- roles/backup/defaults/main.yml | 3 +++ roles/backup/templates/backup.timer | 1 + roles/backup/templates/s3backup.sh | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/backup/defaults/main.yml b/roles/backup/defaults/main.yml index 66b7ad0..c24c0ea 100644 --- a/roles/backup/defaults/main.yml +++ b/roles/backup/defaults/main.yml @@ -3,6 +3,9 @@ backup_script: s3backup restore_script: s3restore # When to kick off backups using the systemd timer backup_time: "*-*-* 02:00:00" +# What variation should the systemd timer have? +# Default value of "5400" is 1h30min in seconds +backup_time_randomization: "5400" # What format should the datestamps in the filenames of any backups be in? # Defaults to YYYY-MM-DD-hhmm # So January 5th, 2021 at 3:41PM would be 2021-01-05-1541 diff --git a/roles/backup/templates/backup.timer b/roles/backup/templates/backup.timer index f871098..08c43ea 100644 --- a/roles/backup/templates/backup.timer +++ b/roles/backup/templates/backup.timer @@ -5,6 +5,7 @@ Description=Nightly backup timer [Timer] Persistent=true OnCalendar={{ backup_time }} +RandomizedDelaySec={{ backup_time_randomization }} [Install] WantedBy=timers.target diff --git a/roles/backup/templates/s3backup.sh b/roles/backup/templates/s3backup.sh index f7e51a2..9d03552 100644 --- a/roles/backup/templates/s3backup.sh +++ b/roles/backup/templates/s3backup.sh @@ -76,7 +76,6 @@ backup() { # --keep-tag foo Keeps all snapshots tagged with "foo" # --host "$HOSTNAME" Only act on *our* snapshots. We assume other machines are taking # care of their own houses. - # --prune Remove orphaned blobs when we remove snapshots /opt/restic-wrapper \ --verbose \ forget \ @@ -85,7 +84,6 @@ backup() { --keep-monthly 6 \ --keep-tag noremove \ --host "$HOSTNAME" \ - --prune } # Dump Postgres DBs, if possible