From e558ab660947b5852b98f332f73d23a669161ea4 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Mon, 25 Nov 2024 14:31:08 +0500 Subject: [PATCH] Specify restic repository in the environment variable --- roles/backups/tasks/main.yml | 1 + roles/backups/templates/backup.sh.j2 | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/backups/tasks/main.yml b/roles/backups/tasks/main.yml index bfde0bb..84382ed 100644 --- a/roles/backups/tasks/main.yml +++ b/roles/backups/tasks/main.yml @@ -15,6 +15,7 @@ AWS_ACCESS_KEY_ID: "{{ s3_access_key_id }}" AWS_SECRET_ACCESS_KEY: "{{ s3_secret_access_key }}" AWS_DEFAULT_REGION: "{{ s3_region }}" + RESTIC_REPOSITORY: s3:https://{{ s3_host }}/{{ s3_bucket }} RESTIC_PASSWORD: "{{ restic_password }}" networks: - name: postgresql diff --git a/roles/backups/templates/backup.sh.j2 b/roles/backups/templates/backup.sh.j2 index 9ff724a..7991d0f 100644 --- a/roles/backups/templates/backup.sh.j2 +++ b/roles/backups/templates/backup.sh.j2 @@ -2,8 +2,8 @@ set -e -docker exec restic-1 restic --repo s3:https://{{ s3_host }}/{{ s3_bucket }} -o s3.bucket-lookup=dns \ +docker exec restic-1 restic -o s3.bucket-lookup=dns \ backup --stdin-filename /data/postgresql.sql --stdin-from-command \ -- pg_dumpall -U postgres -h postgresql --no-password -docker exec restic-1 restic --repo s3:https://{{ s3_host }}/{{ s3_bucket }} -o s3.bucket-lookup=dns backup /data/immich -docker exec restic-1 restic --repo s3:https://{{ s3_host }}/{{ s3_bucket }} -o s3.bucket-lookup=dns forget --keep-daily 7 --keep-weekly 2 +docker exec restic-1 restic -o s3.bucket-lookup=dns backup /data/immich +docker exec restic-1 restic -o s3.bucket-lookup=dns forget --keep-daily 7 --keep-weekly 2