Skip to content
Snippets Groups Projects
Verified Commit 231c9832 authored by nd's avatar nd
Browse files

add support for custom restic flags

parent 9ddce749
Branches
Tags
No related merge requests found
......@@ -18,6 +18,8 @@ backups:
repo_type: local
repo_folder_create: true
additional_keys: {}
flags:
- "--cleanup-cache"
mode: vm-via-hypervisor
enabled: True
retention:
......
......@@ -2,7 +2,7 @@
set_fact:
backup_backend: "{% if backups.mode in ['standalone-restic', 'hypervisor-restic'] %}restic{% else %}False{% endif %}"
backup_executor: "{% if backups.mode in ['vm-via-hypervisor'] %}False{% else %}True{% endif %}"
backup_restic_cache: "{% if backups.backends.restic.repo_type == 'local' %}False{% else %}True{% endif %}"
restic_combined_flags: "{{ (backups.backends.restic.flags + (['--no-cache'] if backups.backends.restic.repo_type == 'local' else []))| join(' ') }}"
- name: create config folder
file:
......
......@@ -6,7 +6,7 @@ set -euo pipefail
source /etc/backup-client/restic.env
restic check --read-data \
--cleanup-cache{% if not backup_restic_cache %} --no-cache{% endif %}
{{ restic_combined_flags }}
{% endif %}
......
......@@ -7,7 +7,7 @@ source /etc/backup-client/retention.env
# restic backend
source /etc/backup-client/restic.env
restic forget \
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
{{ restic_combined_flags }} \
--verbose \
--prune \
--group-by "host,paths,tags" \
......
......@@ -8,7 +8,7 @@ test -f "/etc/backup-client/enabled" || { echo "Standalone backup is disabled";
source /etc/backup-client/restic.env
restic backup \
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
{{ restic_combined_flags }} \
--verbose \
--exclude-caches \
--one-file-system \
......
......@@ -122,7 +122,7 @@ set -euo pipefail
# restic backend
source /etc/backup-client/restic.env
restic backup \
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
{{ restic_combined_flags }} \
--verbose \
--host "$DOMAIN" \
--exclude-file "/etc/backup-client/vms/$DOMAIN/exclude_files" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment