mirror of
https://github.com/roles-ansible/ansible_role_restic_archiver.git
synced 2024-08-16 10:09:49 +02:00
36 lines
1.1 KiB
Django/Jinja
36 lines
1.1 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
# {{ ansible_managed }}
|
|
# This file is to cleanup your backup archive and move some snapshots to a external storage.
|
|
|
|
{% if restic_archiver__cache_config | bool %}
|
|
{% include 'includes/restic_cache.sh.j2' %}
|
|
{% endif %}
|
|
|
|
{% if restic_archiver__mail_on_error | bool %}
|
|
{% include 'includes/set_send_mail_on_error_variable.sh.j2' %}
|
|
{% endif %}
|
|
|
|
{% if restic_archiver__mail_report | default(false) %}
|
|
{% include 'includes/mail_report_header.sh.j2' %}
|
|
{% endif %}
|
|
|
|
{% for repo in restic_archiver__repos %}
|
|
{% include 'includes/repo_todos.sh.j2' %}
|
|
{% endfor %}
|
|
|
|
sync
|
|
|
|
{% if restic_archiver__mail_report | default(false) %}
|
|
{% include 'includes/mail_report_trailer.sh.j2' %}
|
|
{% endif %}
|
|
|
|
{% if restic_archiver__mail_on_error | bool %}
|
|
if [ "$restic_archiver__send_mail_on_error" == true ]; then
|
|
mail -s "[ERROR] restic backup report" {{ restic_archiver__mailaddress }} <<< 'Something went wrong while running restic backup archiver at {{ ansible_hostname }}'
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if restic_archiver__umount_after_usage %}
|
|
umount {{ restic_archiver__mount_disk }}
|
|
{% endif %}
|
|
echo "restic archiver done"
|