Feat: borgmatic start after boot

This commit is contained in:
2022-03-09 10:46:21 +01:00
parent 04d221778b
commit 19658ae596
7 changed files with 37 additions and 36 deletions

View File

@@ -1,5 +1,9 @@
---
# tasks file for borgmatic
- name: debug
debug:
msg: "{{ borgmatic_config_file }}"
- name: stat on sources
stat:
path: "{{ item }}"
@@ -27,12 +31,12 @@
- name: Borgmatic config
template:
src: borgmatic.config.yaml.j2
dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
dest: "{{ borgmatic_config_file }}"
mode: 644
- name: Check borgmatic config
command:
cmd: validate-borgmatic-config
cmd: "validate-borgmatic-config -c {{ borgmatic_config_file}}"
register: validate_borgmatic_config
- name: Assert that config is validate
@@ -42,17 +46,17 @@
- name: copy systemd service
template:
src: borgmatic.service.j2
dest: /etc/systemd/system/borgmatic.service
dest: "/lib/systemd/system/borgmatic_{{ borgmatic_name }}.service"
mode: 644
notify: reload systemd
- name: copy systemd timer
copy:
src: borgmatic.timer
dest: /etc/systemd/system/borgmatic.timer
- name: copy systemd timer for executing borgmatic after boot
template:
src: borgmatic.afterboot.timer.j2
dest: "/lib/systemd/system/borgmatic_{{ borgmatic_name }}.timer"
notify: "reload systemd"
- name: enable timer
systemd:
name: borgmatic
name: "borgmatic_{{ borgmatic_name }}"
enabled: yes