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:05:01 +01:00 committed by Lilian Roller
parent 80baa38a8a
commit 8967f5de7a
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
6 changed files with 63 additions and 1 deletions

View file

@ -49,5 +49,8 @@ restic_archiver__package:
restic_archiver__log_output: true restic_archiver__log_output: true
restic_archiver__logrotate: true restic_archiver__logrotate: true
restic_archiver__mailsummary: false
restic_archiver__mailaddress: false
# version check for this playbook (true is recomended) # version check for this playbook (true is recomended)
submodules_versioncheck: false submodules_versioncheck: false

View file

@ -26,3 +26,4 @@
minute: "{{ restic_archiver__minute }}" minute: "{{ restic_archiver__minute }}"
user: "{{ restic_archiver__owner }}" user: "{{ restic_archiver__owner }}"
when: not restic_archiver__log_output when: not restic_archiver__log_output

10
tasks/mail.yml Normal file
View file

@ -0,0 +1,10 @@
---
- name: deploy restic template
template:
src: templates/restic_mailsummary.j2
dest: /opt/restic-mailsummary.sh
group: "{{ restic_archiver__owner }}"
owner: "{{ restic_archiver__group }}"
mode: 0700
become: true

View file

@ -15,3 +15,6 @@
when: restic_archiver__log_output | bool when: restic_archiver__log_output | bool
- include_tasks: cron.yml - include_tasks: cron.yml
- include_tasks: mail.yml
when: restic_archiver__mailsummary | bool

View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# {{ ansible_managed }}
# This file is to cleanup your backup archive and move some snapshots to a external storage.
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 }}"
echo "BACKUP: {{ repo.name }}"
restic check
restic stats
{% if repo.archive|default(false) %}
{% if restic_archiver__mount_required %}
set +euxo pipefail
if mountpoint -q {{ restic_archiver__mount_disk }}
then
echo "{{ restic_archiver__mount_disk }} is mounted"
else
mount -a
fi
set -euxo pipefail
{% 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"
restic check
restic stats
{% endif %}
{% endfor %}
sync
set +euxo pipefail
df -h
{% if restic_archiver__umount_after_usage %}
umount {{ restic_archiver__mount_disk }}
{% endif %}

View file

@ -1,3 +1,3 @@
--- ---
playbook_version_number: 29 # should be over ninethousand playbook_version_number: 30 # 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'