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

Added support for Backblaze B2 (#18)

authored-by: Luca Zorzi <luca@lucazorzi.net>
This commit is contained in:
Luca Zorzi 2020-09-08 10:17:46 +02:00 committed by GitHub
parent 921f4197f8
commit 308b068f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 1 deletions

View file

@ -6,6 +6,7 @@ and [human-readable changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased ## Unreleased
### Added ### Added
* Sanity check for restic binary * Sanity check for restic binary
* Support for the Backblaze B2 backend
## [0.2.7] 2020-08-05 ## [0.2.7] 2020-08-05
### Added ### Added

View file

@ -87,12 +87,14 @@ Available variables:
| Name | Required | Description | | Name | Required | Description |
| ----------------------- |:--------:| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------- |:--------:| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `location` | yes | The location of the Backend. Currently, [Local](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#local), [SFTP](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#sftp) and [S3](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#amazon-s3) are supported | | `location` | yes | The location of the Backend. Currently, [Local](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#local), [SFTP](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#sftp), [S3](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#amazon-s3) and [B2](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#backblaze-b2) are supported |
| `password` | yes | The password used to secure this repository | | `password` | yes | The password used to secure this repository |
| `init` | no | Describes if the repository should be initialized or not. Use `false` if you are backuping to an already existing repo. | | `init` | no | Describes if the repository should be initialized or not. Use `false` if you are backuping to an already existing repo. |
| `aws_access_key` | no | The access key for the S3 backend | | `aws_access_key` | no | The access key for the S3 backend |
| `aws_secret_access_key` | no | The secret access key for the S3 backend | | `aws_secret_access_key` | no | The secret access key for the S3 backend |
| `aws_default_region` | no | The desired region for the S3 backend | | `aws_default_region` | no | The desired region for the S3 backend |
| `b2_account_id` | no | The account ID for Backblaze B2 backend |
| `b2_account_key` | no | The account key for Backblaze B2 backend |
Example: Example:
```yaml ```yaml

View file

@ -10,6 +10,8 @@
| default("") | default("")
}}' }}'
AWS_DEFAULT_REGION: '{{ item.value.aws_default_region | default("") }}' AWS_DEFAULT_REGION: '{{ item.value.aws_default_region | default("") }}'
B2_ACCOUNT_ID: '{{ item.value.b2_account_id | default("") }}'
B2_ACCOUNT_KEY: '{{ item.value.b2_account_key | default("") }}'
no_log: true no_log: true
register: restic_init register: restic_init
changed_when: "'created restic repository' in restic_init.stdout" changed_when: "'created restic repository' in restic_init.stdout"

View file

@ -14,6 +14,12 @@ export AWS_SECRET_ACCESS_KEY='{{ restic_repos[item.repo].aws_secret_access_key |
{% if restic_repos[item.repo].aws_default_region is defined %} {% if restic_repos[item.repo].aws_default_region is defined %}
export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }}
{% endif %} {% 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 %}
BACKUP_NAME={{ item.name }} BACKUP_NAME={{ item.name }}
{% if item.src is defined %} {% if item.src is defined %}
BACKUP_SOURCE={{ item.src }} BACKUP_SOURCE={{ item.src }}

View file

@ -15,6 +15,12 @@ export AWS_SECRET_ACCESS_KEY='{{ restic_repos[item.repo].aws_secret_access_key |
{% if restic_repos[item.repo].aws_default_region is defined %} {% if restic_repos[item.repo].aws_default_region is defined %}
export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }}
{% endif %} {% 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 %}
{% if item.src is defined %} {% if item.src is defined %}
BACKUP_SOURCE={{ item.src }} BACKUP_SOURCE={{ item.src }}
{% endif %} {% endif %}