From 8b0c016e7d9860991084c7c3c1859029a5238e6e Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger <2-mleutenegger@users.noreply.git.syntro.ch> Date: Tue, 17 Dec 2019 14:19:25 +0100 Subject: [PATCH] ADD: S3 compatibility --- CHANGELOG.md | 5 ++++- README.md | 12 +++++++----- templates/restic_access_Linux.j2 | 6 ++++++ templates/restic_script_Linux.j2 | 6 ++++++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dd870..e95b237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [human-readable changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased +### Added +* S3 Support + ## 0.1.5 ### Changed * Path generation for `forget` task now checks if `src` is actually filled and not only defined. @@ -34,4 +38,3 @@ and [human-readable changelog](https://keepachangelog.com/en/1.0.0/). ## 0.1.0 ### Added * initial release - diff --git a/README.md b/README.md index c8ba86b..5e93903 100644 --- a/README.md +++ b/README.md @@ -85,11 +85,13 @@ official [documentation](https://restic.readthedocs.io/en/stable/030_preparing_a Available variables: -| 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) and [SFTP](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#sftp) are supported | -| `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. | +| 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 | +| `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. | +| `aws_access_key` | no | The access key for the S3 backend | +| `aws_secret_access_key` | no | The secret access key for the S3 backend | Example: ```yaml diff --git a/templates/restic_access_Linux.j2 b/templates/restic_access_Linux.j2 index 4a2cf9a..1bfdf36 100644 --- a/templates/restic_access_Linux.j2 +++ b/templates/restic_access_Linux.j2 @@ -4,6 +4,12 @@ export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} export RESTIC_PASSWORD={{ restic_repos[item.repo].password }} +{% if restic_repos[item.repo].aws_access_key is defined %} +AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} +{% endif %} +{% if restic_repos[item.repo].aws_secret_access_key is defined %} +AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} +{% endif %} BACKUP_NAME={{ item.name }} {% if item.src is defined %} BACKUP_SOURCE={{ item.src }} diff --git a/templates/restic_script_Linux.j2 b/templates/restic_script_Linux.j2 index df536d8..3adb5f9 100644 --- a/templates/restic_script_Linux.j2 +++ b/templates/restic_script_Linux.j2 @@ -5,6 +5,12 @@ export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} export RESTIC_PASSWORD={{ restic_repos[item.repo].password }} BACKUP_NAME={{ item.name }} +{% if restic_repos[item.repo].aws_access_key is defined %} +AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} +{% endif %} +{% if restic_repos[item.repo].aws_secret_access_key is defined %} +AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} +{% endif %} {% if item.src is defined %} BACKUP_SOURCE={{ item.src }} {% endif %}