Browse Source

Archiv settings expanded

pull/15/head
L3D 5 months ago
parent
commit
bea177dd34
Signed by: l3d
GPG Key ID: CD08445BFF4313D1
  1. 8
      defaults/main.yml
  2. 40
      templates/includes/repo_todos.sh.j2
  3. 2
      vars/main.yml

8
defaults/main.yml

@ -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'

40
templates/includes/repo_todos.sh.j2

@ -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"

2
vars/main.yml

@ -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'

Loading…
Cancel
Save