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:
parent
d0a682173f
commit
bea177dd34
3 changed files with 48 additions and 2 deletions
|
@ -28,6 +28,14 @@ restic_archiver__keep_weekly: 8
|
||||||
restic_archiver__keep_monthly: 16
|
restic_archiver__keep_monthly: 16
|
||||||
restic_archiver__keep_yearly: 12
|
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
|
# owner and user of all restic stuff
|
||||||
restic_archiver__owner: 'root'
|
restic_archiver__owner: 'root'
|
||||||
restic_archiver__group: 'root'
|
restic_archiver__group: 'root'
|
||||||
|
|
|
@ -41,6 +41,44 @@
|
||||||
--prune {% endif %}
|
--prune {% endif %}
|
||||||
{%- endmacro %}
|
{%- 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
|
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
|
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
|
||||||
BACKUP_NAME="{{ repo.name }}_archive"
|
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) %}
|
{%- if repo.prune|default(restic_archiver__prune) %}
|
||||||
restic {{ restic_archiver__default_opt }} prune
|
restic {{ restic_archiver__default_opt }} prune
|
||||||
echo "restic ARCHIVE prune done"
|
echo "restic ARCHIVE prune done"
|
||||||
|
|
|
@ -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'
|
playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue