1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00
ansible_role_restic/templates/restic_access_Linux.j2

27 lines
1.1 KiB
Text
Raw Normal View History

2020-05-01 10:56:07 +02:00
#!/usr/bin/env bash
2019-09-11 11:31:51 +02:00
# {{ 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 }}
2020-06-03 08:52:02 +02:00
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
2019-12-17 14:19:25 +01:00
{% if restic_repos[item.repo].aws_access_key is defined %}
2020-05-24 15:13:26 +02:00
export AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }}
2019-12-17 14:19:25 +01:00
{% endif %}
{% if restic_repos[item.repo].aws_secret_access_key is defined %}
2020-06-04 19:22:47 +02:00
export AWS_SECRET_ACCESS_KEY='{{ restic_repos[item.repo].aws_secret_access_key | regex_replace('\'', '\'\\\'\'') }}'
2019-12-17 14:19:25 +01:00
{% endif %}
2020-05-24 13:56:52 +02:00
{% if restic_repos[item.repo].aws_default_region is defined %}
2020-05-24 15:13:26 +02:00
export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }}
2020-05-24 13:56:52 +02:00
{% endif %}
{% if restic_repos[item.repo].b2_account_id is defined %}
export B2_ACCOUNT_ID={{ restic_repos[item.repo].b2_account_id }}
{% endif %}
{% if restic_repos[item.repo].b2_account_key is defined %}
export B2_ACCOUNT_KEY={{ restic_repos[item.repo].b2_account_key }}
{% endif %}
2019-09-11 11:31:51 +02:00
BACKUP_NAME={{ item.name }}
{% if item.src is defined %}
BACKUP_SOURCE={{ item.src }}
{% endif %}