Feat: validate borgconfig and verify repository
This commit is contained in:
parent
34f2494e6f
commit
ac3f412d63
@ -2,6 +2,8 @@
|
|||||||
# defaults file for borgmatic
|
# defaults file for borgmatic
|
||||||
borgmatic_name: default
|
borgmatic_name: default
|
||||||
borg_encryption_passphrase: ''
|
borg_encryption_passphrase: ''
|
||||||
|
borg_source_directories: []
|
||||||
|
borg_repository: []
|
||||||
borg_exclude_patterns: []
|
borg_exclude_patterns: []
|
||||||
borgmatic_config_file: "/etc/borgmatic/{{ borgmatic_name }}.yaml"
|
borgmatic_config_file: "/etc/borgmatic/{{ borgmatic_name }}.yaml"
|
||||||
borgmatic_large_repo: true
|
borgmatic_large_repo: true
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
debug:
|
debug:
|
||||||
msg: "{{ borgmatic_config_file }}"
|
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
|
- name: stat on sources
|
||||||
stat:
|
stat:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
@ -33,15 +41,7 @@
|
|||||||
src: config.yaml.j2
|
src: config.yaml.j2
|
||||||
dest: "{{ borgmatic_config_file }}"
|
dest: "{{ borgmatic_config_file }}"
|
||||||
mode: 644
|
mode: 644
|
||||||
|
validate: "validate-borgmatic-config -c %s"
|
||||||
- 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
|
|
||||||
|
|
||||||
- name: copy systemd service
|
- name: copy systemd service
|
||||||
template:
|
template:
|
||||||
|
Loading…
Reference in New Issue
Block a user