mirror of
https://github.com/roles-ansible/ansible_role_restic_archiver.git
synced 2024-08-16 10:09:49 +02:00
implement new restic arhiver option for compact output
This commit is contained in:
parent
eb9840866d
commit
84c1dbcf4b
4 changed files with 21 additions and 7 deletions
|
@ -70,6 +70,9 @@ restic_archiver__package:
|
||||||
restic_archiver__log_output: true
|
restic_archiver__log_output: true
|
||||||
restic_archiver__logrotate: true
|
restic_archiver__logrotate: true
|
||||||
|
|
||||||
|
# restic default options
|
||||||
|
restic_archiver__default_opt: ' --compact --quiet '
|
||||||
|
|
||||||
# version check for this playbook (true is recomended)
|
# version check for this playbook (true is recomended)
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
```
|
```
|
||||||
|
|
|
@ -52,5 +52,8 @@ restic_archiver__logrotate: true
|
||||||
restic_archiver__mailsummary: false
|
restic_archiver__mailsummary: false
|
||||||
restic_archiver__mailaddress: false
|
restic_archiver__mailaddress: false
|
||||||
|
|
||||||
|
# restic default options
|
||||||
|
restic_archiver__default_opt: ' --compact --quiet '
|
||||||
|
|
||||||
# version check for this playbook (true is recomended)
|
# version check for this playbook (true is recomended)
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
|
|
|
@ -46,6 +46,14 @@
|
||||||
--prune {% endif %}
|
--prune {% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% if restic_archiver__mail_report | default(false) %}
|
||||||
|
|
||||||
|
# collect info about last snapshot for mail report
|
||||||
|
|
||||||
|
restic {{ restic_archiver__default_opt }} stats latest | grep Total
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if restic_archiver__mount_required %}
|
{% if restic_archiver__mount_required %}
|
||||||
if mountpoint -q {{ restic_archiver__mount_disk }}
|
if mountpoint -q {{ restic_archiver__mount_disk }}
|
||||||
then
|
then
|
||||||
|
@ -61,9 +69,9 @@ export RESTIC_REPOSITORY="{{ repo['location'] }}"
|
||||||
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
|
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
|
||||||
BACKUP_NAME="{{ repo.name }}"
|
BACKUP_NAME="{{ repo.name }}"
|
||||||
|
|
||||||
restic forget {{ retention_pattern(repo) }}
|
restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }}
|
||||||
|
|
||||||
restic check
|
restic {{ restic_archiver__default_opt }} check
|
||||||
|
|
||||||
{% if repo.archive|default(false) %}
|
{% if repo.archive|default(false) %}
|
||||||
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
|
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
|
||||||
|
@ -75,7 +83,7 @@ BACKUP_NAME="{{ repo.name }}_archive"
|
||||||
|
|
||||||
# init repo if it does not exist
|
# init repo if it does not exist
|
||||||
if ([ -z "$(restic cat config)" ]) 2>/dev/null; then
|
if ([ -z "$(restic cat config)" ]) 2>/dev/null; then
|
||||||
restic init --copy-chunker-params
|
restic {{ restic_archiver__default_opt }} init --copy-chunker-params
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{% if restic_archiver__mount_required %}
|
{% if restic_archiver__mount_required %}
|
||||||
|
@ -95,7 +103,7 @@ export RESTIC_REPOSITORY="{{ repo['location'] }}"
|
||||||
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
|
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
|
||||||
|
|
||||||
# transfer snapshots to archive
|
# transfer snapshots to archive
|
||||||
restic copy
|
restic {{ restic_archiver__default_opt }} copy
|
||||||
|
|
||||||
{% if repo.archive_cleanup %}
|
{% if repo.archive_cleanup %}
|
||||||
|
|
||||||
|
@ -114,10 +122,10 @@ export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
|
||||||
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 forget {{ retention_pattern(repo) }}
|
restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
restic check
|
restic {{ restic_archiver__default_opt }} check
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 31 # should be over ninethousand
|
playbook_version_number: 32 # should be over ninethousand
|
||||||
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