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

update template and add logging dir

This commit is contained in:
L3D 2021-03-01 11:13:14 +01:00
parent 2904225f80
commit 5e3970d2fa
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 16 additions and 7 deletions

View file

@ -59,3 +59,6 @@ restic_archiver__default_opt: ''
restic_archiver__additional_mail_msg: '' restic_archiver__additional_mail_msg: ''
# version check for this playbook (true is recomended) # version check for this playbook (true is recomended)
submodules_versioncheck: false submodules_versioncheck: false
restic_archiver__cache_config: false
restic_archiver__cache_dir: '~/.cache/restic'

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# {{ ansible_managed }} # {{ ansible_managed }}
# This file is to cleanup your backup archive and move some snapshots to a external storage. # This file is to cleanup your backup archive and move some snapshots to a external storage.
{% if restic_archiver__cache_config | bool %}
# define cache directory
export XDG_CACHE_HOME={{ restic_archiver__cache_dir }}
{% endif %}
{% if restic_archiver__mail_report | default(false) %} {% if restic_archiver__mail_report | default(false) %}
@ -74,12 +80,6 @@ START DUING STUFF INSIDE THE RESTIC REPO FOR LOOP
{ # try { # try
{% 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
@ -94,6 +94,12 @@ 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 }}"
{% 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 %}
echo "init $BACKUP_NAME" echo "init $BACKUP_NAME"
restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }} restic {{ restic_archiver__default_opt }} forget {{ retention_pattern(repo) }}

View file

@ -1,3 +1,3 @@
--- ---
playbook_version_number: 41 # should be int playbook_version_number: 42 # 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'