diff --git a/roles/borg_client/templates/borg-backup.service.j2 b/roles/borg_client/templates/borg-backup.service.j2 index 001eaaa452507d2a5625b5ea4c88c1cb5ad177e6..bc26b541c57ef8f6f9fd25247b4dae7ec796efa1 100644 --- a/roles/borg_client/templates/borg-backup.service.j2 +++ b/roles/borg_client/templates/borg-backup.service.j2 @@ -1,5 +1,10 @@ [Unit] Description=Borg backup + +{% if inventory_hostname == "gitlab.archlinux.org" %} +# The ordering relation defined below is important for the GitLab backups +# because the offsite backup reuses the tarballs from this service's run. +{% endif %} Wants=borg-backup-offsite.service Before=borg-backup-offsite.service diff --git a/roles/borg_client/templates/borg-backup.sh.j2 b/roles/borg_client/templates/borg-backup.sh.j2 index ade832c00413a89137cfcee9ebb872749ab3e026..27128144815316ce55ae96981837702a65362cc1 100644 --- a/roles/borg_client/templates/borg-backup.sh.j2 +++ b/roles/borg_client/templates/borg-backup.sh.j2 @@ -45,7 +45,8 @@ if systemctl is-active mysqld || systemctl is-active mariadb; then /usr/local/bin/backup-mysql.sh || true fi -{% if inventory_hostname == "gitlab.archlinux.org" %} +{# When backing up to offsite, reuse the existing tarballs from the previous backup #} +{% if inventory_hostname == "gitlab.archlinux.org" and item['suffix'] != '-offsite' %} # Create tarball backups of various GitLab directories using the official backup tool systemctl is-active docker && /usr/local/bin/backup-gitlab.sh {% endif %}