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

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