add support for custom restic flags
This commit is contained in:
parent
9ddce74914
commit
231c983205
6 changed files with 7 additions and 5 deletions
|
|
@ -18,6 +18,8 @@ backups:
|
||||||
repo_type: local
|
repo_type: local
|
||||||
repo_folder_create: true
|
repo_folder_create: true
|
||||||
additional_keys: {}
|
additional_keys: {}
|
||||||
|
flags:
|
||||||
|
- "--cleanup-cache"
|
||||||
mode: vm-via-hypervisor
|
mode: vm-via-hypervisor
|
||||||
enabled: True
|
enabled: True
|
||||||
retention:
|
retention:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
backup_backend: "{% if backups.mode in ['standalone-restic', 'hypervisor-restic'] %}restic{% else %}False{% endif %}"
|
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_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
|
- name: create config folder
|
||||||
file:
|
file:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ set -euo pipefail
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
|
|
||||||
restic check --read-data \
|
restic check --read-data \
|
||||||
--cleanup-cache{% if not backup_restic_cache %} --no-cache{% endif %}
|
{{ restic_combined_flags }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ source /etc/backup-client/retention.env
|
||||||
# restic backend
|
# restic backend
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
restic forget \
|
restic forget \
|
||||||
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
{{ restic_combined_flags }} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--prune \
|
--prune \
|
||||||
--group-by "host,paths,tags" \
|
--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
|
source /etc/backup-client/restic.env
|
||||||
|
|
||||||
restic backup \
|
restic backup \
|
||||||
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
{{ restic_combined_flags }} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--exclude-caches \
|
--exclude-caches \
|
||||||
--one-file-system \
|
--one-file-system \
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ set -euo pipefail
|
||||||
# restic backend
|
# restic backend
|
||||||
source /etc/backup-client/restic.env
|
source /etc/backup-client/restic.env
|
||||||
restic backup \
|
restic backup \
|
||||||
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
{{ restic_combined_flags }} \
|
||||||
--verbose \
|
--verbose \
|
||||||
--host "$DOMAIN" \
|
--host "$DOMAIN" \
|
||||||
--exclude-file "/etc/backup-client/vms/$DOMAIN/exclude_files" \
|
--exclude-file "/etc/backup-client/vms/$DOMAIN/exclude_files" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue