diff --git a/roles/borgmatic/defaults/main.yml b/roles/borgmatic/defaults/main.yml index 530bb85..c3a2609 100644 --- a/roles/borgmatic/defaults/main.yml +++ b/roles/borgmatic/defaults/main.yml @@ -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 diff --git a/roles/borgmatic/tasks/main.yml b/roles/borgmatic/tasks/main.yml index 9a436c2..8d385ca 100644 --- a/roles/borgmatic/tasks/main.yml +++ b/roles/borgmatic/tasks/main.yml @@ -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: