1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic_archiver.git synced 2024-08-16 10:09:49 +02:00

Archiv settings expanded

This commit is contained in:
L3D 2022-02-02 13:03:37 +01:00
parent d0a682173f
commit bea177dd34
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 48 additions and 2 deletions

View file

@ -28,6 +28,14 @@ restic_archiver__keep_weekly: 8
restic_archiver__keep_monthly: 16
restic_archiver__keep_yearly: 12
restic_archiver__archive_keep: 5
restic_archiver__archive_keep_hourly: 16
restic_archiver__archive_keep_daily: 14
restic_archiver__archive_keep_weekly: 8
restic_archiver__archive_keep_monthly: 16
restic_archiver__archive_keep_yearly: 12
# owner and user of all restic stuff
restic_archiver__owner: 'root'
restic_archiver__group: 'root'

View file

@ -41,6 +41,44 @@
--prune {% endif %}
{%- endmacro %}
{% macro retention_archive_pattern(repo) -%}
{% if repo.keep_last is defined and repo.archive_keep_last != None -%}
--keep-last {{ repo.archive_keep_last }}
{%- else -%}
--keep-last {{ restic_archiver__archive_keep }}
{%- endif %} \
{% if repo.keep_hourly is defined and repo.archive_keep_hourly != None -%}
--keep-hourly {{ repo.archive_keep_hourly }}
{%- else -%}
--keep-hourly {{ restic_archiver__archive_keep_hourly }}
{%- endif %} \
{% if repo.keep_daily is defined and repo.archive_keep_daily != None -%}
--keep-daily {{ repo.archive_keep_daily }}
{%- else -%}
--keep-daily {{ restic_archiver__archive_keep_daily }}
{%- endif %} \
{% if repo.keep_weekly is defined and repo.archive_keep_weekly != None -%}
--keep-weekly {{ repo.archive_keep_weekly }}
{%- else -%}
--keep-weekly {{ restic_archiver__archive_keep_weekly }}
{%- endif %} \
{% if repo.keep_monthly is defined and repo.archive_keep_monthly != None -%}
--keep-monthly {{ repo.archive_keep_monthly }}
{%- else -%}
--keep-monthly {{ restic_archiver__archive_keep_monthly }}
{%- endif %} \
{% if repo.keep_yearly is defined and repo.archive_keep_yearly != None -%}
--keep-yearly {{ repo.archive_keep_yearly }}
{%- else -%}
--keep-yearly {{ restic_archiver__archive_keep_yearly }}
{%- endif -%}
{% if repo.keep_within is defined and repo.archive_keep_within != None %} \
--keep-within {{ repo.archive_keep_within }} {% endif -%}
{%- if repo.prune|default(restic_archiver__prune) %} \
--prune {% endif %}
{%- endmacro %}
{#
START DOING STUFF INSIDE THE RESTIC REPO FOR LOOP
#}
@ -137,7 +175,7 @@ EOT
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}_archive"
restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }}
restic {{ restic_archiver__default_opt }} forget {{ retention_archive_pattern(repo) }}
{%- if repo.prune|default(restic_archiver__prune) %}
restic {{ restic_archiver__default_opt }} prune
echo "restic ARCHIVE prune done"

View file

@ -1,3 +1,3 @@
---
playbook_version_number: 51 # should be int
playbook_version_number: 52 # should be int
playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'