From 0053f18814a46b360871045cfd7606ec746142b0 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Wed, 11 Sep 2019 11:31:51 +0200 Subject: [PATCH] add credential file --- README.md | 6 +++--- templates/restic_access_Linux.j2 | 10 ++++++++++ templates/restic_script_Linux.j2 | 3 +-- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 templates/restic_access_Linux.j2 diff --git a/README.md b/README.md index 1c1c251..d3d08c8 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Aditionally, it will setup executable scripts to run a Backup manually. > automated backup definition for use with windows systems. ### Backup Scripts -This role will create a backup script for each backup in the `restic_script_dir`. +This role will create a backup script and a file with credentials usable with the `source` command on linux for each backup in the `restic_script_dir`. These executable scripts can be used to manually trigger a backup action, but -are also used for automated backups if you hgave set `restic_create_cron` to true. +are also used for automated backups if you have set `restic_create_cron` to true. make sure to not change the files manually, as this can interfere with your backups quite a bit. @@ -126,7 +126,7 @@ Available variables: | `keep_monthly` | no | If set, only keeps the last n monthly snapshots. | | `keep_yearly ` | no | If set, only keeps the last n yearly snapshots. | | `keep_within` | no | If set, only keeps snapshots in this time period. | -| `keep_tag` | no | If set, keep snapshots with this tags. Make sure to specify a list. | +| `keep_tag` | no | If set, keep snapshots with this tags. Make sure to specify a list. | | `scheduled` | no (`false`) | If `restic_create_cron` is set to `true`, this backup is scheduled. | | `schedule_minute` | no (`*`) | Minute when the job is run. ( 0-59, *, */2, etc ) | | `schedule_hour` | no (`*`) | Hour when the job is run. ( 0-23, *, */2, etc ) | diff --git a/templates/restic_access_Linux.j2 b/templates/restic_access_Linux.j2 new file mode 100644 index 0000000..4a2cf9a --- /dev/null +++ b/templates/restic_access_Linux.j2 @@ -0,0 +1,10 @@ +# {{ ansible_managed }} +# Backup credentials for {{ item.src|default('stdin') }} +# Source this file to work with restic on this host + +export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} +export RESTIC_PASSWORD={{ restic_repos[item.repo].password }} +BACKUP_NAME={{ item.name }} +{% if item.src is defined %} +BACKUP_SOURCE={{ item.src }} +{% endif %} diff --git a/templates/restic_script_Linux.j2 b/templates/restic_script_Linux.j2 index 20ebe7a..955b363 100644 --- a/templates/restic_script_Linux.j2 +++ b/templates/restic_script_Linux.j2 @@ -1,7 +1,6 @@ # {{ ansible_managed }} # Backup script for {{ item.src|default('stdin') }} -# Use this file to create a Backup and prune existing data. -set -euxo pipefail +# Use this file to create a Backup and prune existing data with one execution. export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} export RESTIC_PASSWORD={{ restic_repos[item.repo].password }}