feat(lvm_self_backup): Add error service when systemd service fails

This is to be notified when the systemd service fails to e.g. unmount the partition.
This commit is contained in:
saibotk 2024-02-21 22:25:46 +01:00
parent 43535443c2
commit 4dfd382a75
Signed by: saibotk
GPG key ID: 67585F0065E261D5
2 changed files with 8 additions and 1 deletions

View file

@ -55,7 +55,7 @@
dest: "/usr/local/bin/backup-lvm-ls"
become: true
- name: Install backup service & timer.
- name: Install backup services & timer.
ansible.builtin.template:
src: "{{ item }}"
dest: /etc/systemd/system/
@ -63,6 +63,7 @@
owner: "root"
group: "root"
with_items:
- "backup-error.service"
- "backup-lvm.service"
- "backup-lvm.timer"
notify: Reload systemd config

View file

@ -0,0 +1,6 @@
[Unit]
Description=Writes the error for the monitoring to pick the failure up.
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'echo 1337 > {{ lvm_self_backup_status_directory }}/backup.status && chown {{ lvm_self_backup_status_directory_uid }}:{{ lvm_self_backup_status_directory_gid }} {{ lvm_self_backup_status_directory }}/backup.status'