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 %}
|
2023-08-23 21:54:30 +02:00
|
|
|
{% if restic_repos[item.repo].azure_account_name is defined %}
|
|
|
|
export AZURE_ACCOUNT_NAME={{ restic_repos[item.repo].azure_account_name }}
|
|
|
|
{% endif %}
|
|
|
|
{% if restic_repos[item.repo].azure_account_key is defined %}
|
|
|
|
export AZURE_ACCOUNT_KEY={{ restic_repos[item.repo].azure_account_key }}
|
|
|
|
{% endif %}
|
|
|
|
{% if restic_repos[item.repo].azure_account_sas is defined %}
|
|
|
|
export AZURE_ACCOUNT_SAS={{ restic_repos[item.repo].azure_account_sas }}
|
|
|
|
{% endif %}
|
|
|
|
{% if restic_repos[item.repo].azure_endpoint_suffix is defined %}
|
|
|
|
export AZURE_ENDPOINT_SUFFIX={{ restic_repos[item.repo].azure_endpoint_suffix }}
|
|
|
|
{% endif %}
|
2020-09-08 10:17:46 +02:00
|
|
|
{% 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 %}
|