Support for multiple repositories. By @p-rintz (#41)
This commit is contained in:
parent
0a490a3a6f
commit
ee6f93f71b
@ -51,7 +51,7 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgba
|
|||||||
## Role Variables
|
## Role Variables
|
||||||
|
|
||||||
### Required Arguments
|
### Required Arguments
|
||||||
- `borg_repository`: Full path to repository. Your own server or [BorgBase.com](https://www.borgbase.com) repo. Not required when using auto creation of repositories.
|
- `borg_repository`: Full path to repository. Your own server or [BorgBase.com](https://www.borgbase.com) repo. Not required when using auto creation of repositories. Can be a list if you want to backup to multiple repositories.
|
||||||
- `borg_source_directories`: List of local folders to back up.
|
- `borg_source_directories`: List of local folders to back up.
|
||||||
|
|
||||||
### Optional Arguments
|
### Optional Arguments
|
||||||
@ -80,7 +80,7 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgba
|
|||||||
|
|
||||||
|
|
||||||
### Optional Arguments for [BorgBase.com](https://www.borgbase.com) repository auto creation
|
### Optional Arguments for [BorgBase.com](https://www.borgbase.com) repository auto creation
|
||||||
This role can also set up a new repository on BorgBase, using the arguments below. Thanks to [Philipp Rintz](https://github.com/p-rintz) for contribution this feature.
|
This role can also set up a new repository on BorgBase, using the arguments below. Thanks to [Philipp Rintz](https://github.com/p-rintz) for contribution of this feature.
|
||||||
|
|
||||||
- `create_repo`: Whether to let the role create the repository for the server. Default: False
|
- `create_repo`: Whether to let the role create the repository for the server. Default: False
|
||||||
- `bb_token`: Your [BorgBase.com](https://www.borgbase.com) API-Token. Should be Create Only for security reasons.
|
- `bb_token`: Your [BorgBase.com](https://www.borgbase.com) API-Token. Should be Create Only for security reasons.
|
||||||
|
@ -60,7 +60,14 @@
|
|||||||
|
|
||||||
- name: Set Repository Fact
|
- name: Set Repository Fact
|
||||||
set_fact:
|
set_fact:
|
||||||
borg_repository: "{{ repo_creation['data']['repoPath'] }}"
|
borg_repository: |-
|
||||||
|
{% if borg_repository is defined and borg_repository is string %}
|
||||||
|
{{ [borg_repository] + [ repo_creation['data']['repoPath'] ] }}
|
||||||
|
{% elif borg_repository is defined %}
|
||||||
|
{{ borg_repository + [ repo_creation['data']['repoPath'] ] }}
|
||||||
|
{% else %}
|
||||||
|
{{ repo_creation['data']['repoPath'] }}
|
||||||
|
{% endif %}
|
||||||
when: create_repo
|
when: create_repo
|
||||||
|
|
||||||
- name: Ensures /etc/borgmatic exists
|
- name: Ensures /etc/borgmatic exists
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True", trim_blocks: "True"
|
||||||
# Full config: https://gist.github.com/coaxial/46e36d89d7b81887f7275d587fe04c44
|
# Full config: https://gist.github.com/coaxial/46e36d89d7b81887f7275d587fe04c44
|
||||||
location:
|
location:
|
||||||
source_directories:
|
source_directories:
|
||||||
@ -8,7 +9,13 @@ location:
|
|||||||
# Stay in same file system (do not cross mount points).
|
# Stay in same file system (do not cross mount points).
|
||||||
one_file_system: {{ borg_one_file_system }}
|
one_file_system: {{ borg_one_file_system }}
|
||||||
repositories:
|
repositories:
|
||||||
|
{% if borg_repository is iterable and (borg_repository is not string and borg_repository is not mapping) %}
|
||||||
|
{% for repo in borg_repository %}
|
||||||
|
- {{ repo }}
|
||||||
|
{% endfor %}
|
||||||
|
{% elif borg_repository is defined and borg_repository is string %}
|
||||||
- {{ borg_repository }}
|
- {{ borg_repository }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Any paths matching these patterns are excluded from backups. Globs and tildes
|
# Any paths matching these patterns are excluded from backups. Globs and tildes
|
||||||
# are expanded. See the output of "borg help patterns" for more details.
|
# are expanded. See the output of "borg help patterns" for more details.
|
||||||
|
Loading…
Reference in New Issue
Block a user