Parcourir la source

add ability to exclude multiple directories from cloud backups

Blaine Story il y a 2 ans
Parent
commit
145ff9d5f4

+ 5 - 3
plays/nas-services.yml

@@ -19,7 +19,9 @@
       - smb
 
     backups: containers
-    backups_ignore: /mergerfs /run/udev
+    backups_ignore:
+      - /mergerfs
+      - /run/udev
 
     container_user: "{{ vaulted_media_user }}"
     container_uid: "{{ vaulted_media_uid }}"
@@ -58,7 +60,7 @@
           - 9091:9091
         volumes:
           - /opt/transmission:/config
-          - /mergerfs/private/processing:/mergerfs/private/processing
+          - /mergerfs:/mergerfs
         include_global_env_vars: true
         environment:
           - USER={{ vaulted_nas_transmission_username }}
@@ -74,7 +76,7 @@
           - 8080:8080
         volumes:
           - /opt/qbittorrent:/config
-          - /mergerfs/private/processing/qbittorrent:/mergerfs/private/processing/qbittorent
+          - /mergerfs:/mergerfs
         include_global_env_vars: true
         environment:
           - WEBUI_PORT=8080

+ 1 - 1
roles/cloud-backups/templates/backup-to-b2.sh.j2

@@ -8,7 +8,7 @@ LOG_FILE="/var/log/rclone/rclone-$(date +%Y-%m-%d).log"
 {% for container in containers %}
 {% if container.volumes is defined %}
 {% for volume in container.volumes %}
-{% if backups_ignore not in volume|regex_replace(':.*') %}
+{% if volume|regex_replace(':.*') not in backups_ignore %}
 echo "Starting backup of '{{ container.name }}:{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
 /usr/bin/rclone copy {{ volume | regex_replace(':.*') }}/ b2-container-data:current/{{ ansible_hostname }}/{{ container.name }}/{{ volume | regex_replace(':.*') | basename }} \
       --backup-dir=b2-container-data:old/{{ ansible_hostname }}/{{ container.name }}/{{ volume | regex_replace(':.*') | basename }} \

+ 1 - 1
roles/cloud-backups/templates/restore-from-b2.sh.j2

@@ -6,7 +6,7 @@
 {% for container in containers %}
 {% if container.volumes is defined %}
 {% for volume in container.volumes %}
-{% if backups_ignore not in volume|regex_replace(':.*') %}
+{% if volume|regex_replace(':.*') not in backups_ignore %}
 
 BACKUP_DIR='/opt/restores{{ volume | regex_replace(':.*') }}'