add credential file

This commit is contained in:
Matthias Leutenegger 2019-09-11 11:31:51 +02:00
parent d97bbf8fce
commit 0053f18814
3 changed files with 14 additions and 5 deletions

View file

@ -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.

View file

@ -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 %}

View file

@ -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 }}