From 3ddad038c4d5db70ad09e735a5562fe329183729 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 16 Jul 2021 00:04:52 +0200 Subject: [PATCH] improve restic pruning --- templates/restic_forget_snapshots.j2 | 9 +++++++++ vars/main.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/restic_forget_snapshots.j2 b/templates/restic_forget_snapshots.j2 index 53c1be7..4696729 100644 --- a/templates/restic_forget_snapshots.j2 +++ b/templates/restic_forget_snapshots.j2 @@ -107,6 +107,11 @@ restic {{ restic_archiver__default_opt }} stats latest | grep Total echo "init $BACKUP_NAME" restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }} +echo "restic forget done" +{%- if repo.prune|default(restic_archiver__prune) %} +restic {{ restic_archiver__default_opt }} prune +echo "restic prune done" +{% endif %} {% if restic_archiver__mail_report | default(false) %} cat <> /tmp/mailcontent @@ -186,6 +191,10 @@ export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\ BACKUP_NAME="{{ repo.name }}_archive" restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }} +{%- if repo.prune|default(restic_archiver__prune) %} +restic {{ restic_archiver__default_opt }} prune +echo "restic ARCHIVE prune done" +{% endif %} {% endif %} {% if restic_archiver__mail_report | default(false) %} diff --git a/vars/main.yml b/vars/main.yml index 90d20c8..06d2cf6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,3 @@ --- -playbook_version_number: 45 # should be int +playbook_version_number: 46 # should be int playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'