From 0a490a3a6f9dcfada3563e42ca9a5dc07e2ec7e4 Mon Sep 17 00:00:00 2001 From: Lukas Leitsch Date: Tue, 3 Nov 2020 09:43:33 +0100 Subject: [PATCH] Add hooks variable to config template. By @lukasleitsch (#40) --- README.md | 1 + defaults/main.yml | 1 + templates/config.yaml.j2 | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/README.md b/README.md index e710e0d..9918297 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgba - `borgmatic_failure_command`: Run this command when an error occurs. E.g. `curl -s -F "token=xxx" -F "user=xxx" -F "message=Error during backup" https://api.pushover.net/1/messages.json` - `borgmatic_before_backup_command`: Run this command before the backup. E.g. `dump-a-database /to/file.sql` - `borgmatic_after_backup_command`: Run this command after the backup. E.g. `rm /to/file.sql` +- `borgmatic_hooks`: Hooks to monitor your backups e.g. with [Healthchecks](https://healthchecks.io/). See [official documentation](https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/) for more. - `borgmatic_failure_command`: Run this command when an error occurs. E.g. `curl -s -F "token=xxx" -F "user=xxx" -F "message=Error during backup" https://api.pushover.net/1/messages.json` - `borg_exclude_patterns`: Paths or patterns to exclude from backup. See [official documentation](https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-patterns) for more. - `borg_one_file_system`: Don't cross file-system boundaries. Defaults to `true` diff --git a/defaults/main.yml b/defaults/main.yml index 1f1d1ea..3b73190 100755 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,6 +7,7 @@ borgmatic_failure_command: - echo "`date` - Error while creating a backup." borgmatic_before_backup_command: [] borgmatic_after_backup_command: [] +borgmatic_hooks: [] borg_one_file_system: true borg_exclude_from: [] borg_encryption_passcommand: false diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 index 2e90f33..9b30c41 100644 --- a/templates/config.yaml.j2 +++ b/templates/config.yaml.j2 @@ -171,3 +171,7 @@ hooks: {% for cmd in borgmatic_failure_command %} - {{ cmd }} {% endfor %} + +{% for hook in borgmatic_hooks %} + {{ hook }}: {{ borgmatic_hooks[hook] }} +{% endfor %}