add borgmatic role
This commit is contained in:
48
roles/borgmatic/molecule/default/verify.yml
Normal file
48
roles/borgmatic/molecule/default/verify.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
|
||||
vars:
|
||||
repo_path: "/home/borg/test-repo"
|
||||
|
||||
tasks:
|
||||
- name: "Include default vars"
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
|
||||
extensions: [ 'yml' ]
|
||||
|
||||
- name: "Check if Borg is installed"
|
||||
changed_when: false
|
||||
register: borg_installed_version
|
||||
ansible.builtin.command: "/usr/bin/borg --version"
|
||||
|
||||
- name: "Check Borg version"
|
||||
ansible.builtin.assert:
|
||||
that: borg_installed_version.stdout.find(borg_version)
|
||||
success_msg: "borg version {{ borg_version }} is installed and working"
|
||||
fail_msg: "borg version {{ borg_version }} is not installed or not working correctly"
|
||||
|
||||
- name: "Check if Borgmatic is installed"
|
||||
changed_when: false
|
||||
register: borgmatic_installed_version
|
||||
ansible.builtin.command:
|
||||
cmd: "/usr/bin/borgmatic --version"
|
||||
|
||||
- name: "Check that the test repo was created"
|
||||
register: test_repo_readme
|
||||
failed_when: test_repo_readme.stat.exists is false
|
||||
ansible.builtin.stat:
|
||||
path: "{{ repo_path }}"
|
||||
|
||||
- name: "Check that the systemd timer for Borgmatic is up and running"
|
||||
register: timer
|
||||
ansible.builtin.systemd:
|
||||
name: borgmatic.timer
|
||||
|
||||
- name: "Assert that the timer is running"
|
||||
ansible.builtin.assert:
|
||||
that: timer.status.ActiveState == "active"
|
||||
success_msg: "Timer is running"
|
||||
fail_msg: "Unexpected timer state: '{{ timer.status.ActiveState }}'"
|
||||
Reference in New Issue
Block a user