add better remote repo support

This commit is contained in:
nd 2021-06-24 20:52:22 +02:00
parent de9e0004f6
commit c52a5e2d57
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 11 additions and 8 deletions

View file

@ -36,6 +36,8 @@ backends:
url: '/var/backup-client/restic' url: '/var/backup-client/restic'
# repository type can be 'local' or 'sftp' # repository type can be 'local' or 'sftp'
repo_type: 'local' repo_type: 'local'
# additional repo keys to add. Format is "user: key"
additional_keys: {}
# Mode in which the backup is taken. One of the following: # Mode in which the backup is taken. One of the following:
# #

View file

@ -16,6 +16,7 @@ backups:
restic: restic:
url: /var/backup-client/restic url: /var/backup-client/restic
repo_type: local repo_type: local
additional_keys: {}
mode: vm-via-hypervisor mode: vm-via-hypervisor
enabled: True enabled: True
retention: retention:
@ -36,9 +37,9 @@ backups:
enabled: False enabled: False
create_storage_folder: True create_storage_folder: True
exclude_files: exclude_files:
'/tmp': true '/tmp/*': true
'/var/tmp': true '/var/tmp/*': true
'/var/cache': true '/var/cache/*': true
'/root/.ansible/': true '/root/.ansible/*': true
include_files: include_files:
'/': true '/': true

View file

@ -154,7 +154,9 @@
state: "{{ item }}" state: "{{ item }}"
- name: handle common restic based setup tasks - name: handle common restic based setup tasks
when: backup_backend == 'restic' when:
- backup_backend == 'restic'
- backup_executor
block: block:
- name: install backend tools (restic) - name: install backend tools (restic)
apt: apt:
@ -202,11 +204,9 @@
group: root group: root
mode: 0700 mode: 0700
- name: create repo for restic - name: create repo for restic
when: backups.backends.restic.repo_type == 'local' shell: 'source /etc/backup-client/restic.env; restic snapshots > /dev/null || restic init'
shell: 'source /etc/backup-client/restic.env; restic init'
args: args:
executable: /bin/bash executable: /bin/bash
creates: "{{ backups.backends.restic.url }}/config"
- name: handle hypervisor mode - name: handle hypervisor mode
when: backups.mode == 'hypervisor-restic' when: backups.mode == 'hypervisor-restic'