Feat: validate borgconfig and verify repository

This commit is contained in:
Bertrand Benjamin 2022-03-20 18:56:58 +01:00
parent 34f2494e6f
commit ac3f412d63
2 changed files with 11 additions and 9 deletions

View File

@ -2,6 +2,8 @@
# defaults file for borgmatic
borgmatic_name: default
borg_encryption_passphrase: ''
borg_source_directories: []
borg_repository: []
borg_exclude_patterns: []
borgmatic_config_file: "/etc/borgmatic/{{ borgmatic_name }}.yaml"
borgmatic_large_repo: true

View File

@ -4,6 +4,14 @@
debug:
msg: "{{ borgmatic_config_file }}"
- name: Assert borg_source_directories not empty
assert:
that: "{{ borg_source_directories != [] }}"
- name: Assert borg_repository not empty
assert:
that: "{{ borg_repository != [] }}"
- name: stat on sources
stat:
path: "{{ item }}"
@ -33,15 +41,7 @@
src: config.yaml.j2
dest: "{{ borgmatic_config_file }}"
mode: 644
- name: Check borgmatic config
command:
cmd: "validate-borgmatic-config -c {{ borgmatic_config_file}}"
register: validate_borgmatic_config
- name: Assert that config is validate
assert:
that: validate_borgmatic_config.failed != true
validate: "validate-borgmatic-config -c %s"
- name: copy systemd service
template: