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

Restic create mail overview...

This commit is contained in:
L3D 2020-12-14 16:13:34 +01:00 committed by Lilian Roller
parent 8967f5de7a
commit 714e1f3ada
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
2 changed files with 20 additions and 19 deletions

View file

@ -58,7 +58,7 @@ set -euxo pipefail
# Settings for Server {{ repo['name'] | string }}
export RESTIC_REPOSITORY="{{ repo['location'] }}"
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}"
restic forget {{ retention_pattern(repo) }}
@ -68,9 +68,9 @@ restic check
{% if repo.archive|default(false) %}
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
export RESTIC_REPOSITORY2="{{ repo['location'] }}"
export RESTIC_PASSWORD2='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD2='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}_archive"
# init repo if it does not exist
@ -90,9 +90,9 @@ set -euxo pipefail
{% endif %}
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
export RESTIC_REPOSITORY2="{{ repo['archive_location'] }}"
export RESTIC_PASSWORD2='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD2='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
export RESTIC_REPOSITORY="{{ repo['location'] }}"
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
# transfer snapshots to archive
restic copy
@ -111,7 +111,7 @@ set -euxo pipefail
{% endif %}
# ARCHIVE CLEANUP Settings for Server "{{ repo['name'] | string }}"
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}_archive"
restic forget {{ retention_pattern(repo) }}

View file

@ -6,39 +6,40 @@ echo "Summary for Restic Backup"
{% for repo in restic_archiver__repos %}
# Settings for Server {{ repo['name'] | string }}
export RESTIC_REPOSITORY="{{ repo['location'] }}"
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}'
BACKUP_NAME="{{ repo.name }}"
export RESTIC_REPOSITORY="{{ repo['location'] }}" 2>/dev/null
export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}" 2>/dev/null
echo "BACKUP: {{ repo.name }}"
restic check
restic stats
restic check 2>/dev/null
restic stats 2>/dev/null
{% if repo.archive|default(false) %}
{% if restic_archiver__mount_required %}
set +euxo pipefail
set +euxo pipefail 2>/dev/null
if mountpoint -q {{ restic_archiver__mount_disk }}
then
echo "{{ restic_archiver__mount_disk }} is mounted"
else
mount -a
mount -a 2>/dev/null
fi
set -euxo pipefail
set -euxo pipefail 2>/dev/null
{% endif %}
# ARCHIVE Settings for Server "{{ repo['name'] | string }}"
echo "EXTERNAL_BACKUP: {{ repo.name }}"
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}"
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}'
BACKUP_NAME="{{ repo.name }}_archive"
export RESTIC_REPOSITORY="{{ repo['archive_location'] }}" 2>/dev/null
export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null
BACKUP_NAME="{{ repo.name }}_archive" 2>/dev/null
restic check
restic stats
restic check 2>/dev/null
restic statps
{% endif %}
{% endfor %}
sync
set +euxo pipefail
echo "\n\n\n\n"
df -h
{% if restic_archiver__umount_after_usage %}
umount {{ restic_archiver__mount_disk }}