Use the prefix everywhere

This commit is contained in:
Kuba Orlik 2025-09-13 00:11:17 +02:00
parent 3df4186816
commit 0cb6927831
3 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Sets up backups to Cloudflare R2
# Instalation
In requirements.yml:
@ -8,3 +13,9 @@ roles:
version: master
name: setup-backups
```
# Setup
Create a Cloudflare R2 account and create an admin token.

View File

@ -69,7 +69,7 @@
failed_when: "command_result.rc!=0 and 'repository master key and config already initialized' not in command_result.stderr"
changed_when: "false"
environment:
RESTIC_REPOSITORY: "s3:{{ cloudflare_r2_endpoint }}/icd-backup-{{ inventory_hostname }}"
RESTIC_REPOSITORY: "s3:{{ cloudflare_r2_endpoint }}/{{ backup_bucket_prefix }}-{{ inventory_hostname }}"
AWS_ACCESS_KEY_ID: "{{ cloudflare_r2_access_key }}"
AWS_SECRET_ACCESS_KEY: "{{ cloudflare_r2_secret_key }}"
tags:

View File

@ -1,5 +1,5 @@
declare -a DIRS_TO_BACKUP=({% for item in all_backup_paths %}"{{ item }}"{% if not loop.last %} {% endif %}{% endfor %})
export DIRS_TO_BACKUP_STR=$(declare -p DIRS_TO_BACKUP)
export RESTIC_REPOSITORY="rclone:cloudflare-r2:icd-backup-{{ inventory_hostname }}"
export RESTIC_REPOSITORY="rclone:cloudflare-r2:{{ backup_bucket_prefix }}-{{ inventory_hostname }}"
export PWD_FILE=/backup-pwd
export RESTIC=/usr/bin/restic