From 834f40d3ad65a7ca8e2a28b5cb98a1746cc7cf97 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Thu, 23 Jan 2025 12:21:42 -0600 Subject: [PATCH] Implement ignore rules in restic --- roles/backup/templates/s3backup.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/roles/backup/templates/s3backup.sh b/roles/backup/templates/s3backup.sh index 796cade..5c5a5de 100644 --- a/roles/backup/templates/s3backup.sh +++ b/roles/backup/templates/s3backup.sh @@ -59,6 +59,14 @@ backup() { # we can script around it. /opt/restic-wrapper \ --verbose \ + {% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %} + --exclude="{{ item }}" \ + {% endfor %} + --exclude="/data/**/backup" \ + --exclude="/data/**/backups" \ + --exclude="*.bak" \ + --exclude="*.tmp" \ + --exclude="*.swp" \ backup \ "$@" # In addition, we should also prune our backups @@ -129,12 +137,7 @@ if [ -n "${DIRS[*]}" ]; then for dir in "${DIRS[@]}"; do echo "- $dir" done - if command -v restic > /dev/null 2>&1; then - echo "An ignore list was specified, but restic was detected as the backup method." - echo "The following list of items WILL be backed up:" - else - echo "Will ignore the following items:" - fi + echo "Will ignore the following items:" {% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %} echo "- {{ item }}" {% endfor %}