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:
parent
43535443c2
commit
4dfd382a75
2 changed files with 8 additions and 1 deletions
|
@ -55,7 +55,7 @@
|
||||||
dest: "/usr/local/bin/backup-lvm-ls"
|
dest: "/usr/local/bin/backup-lvm-ls"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Install backup service & timer.
|
- name: Install backup services & timer.
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: /etc/systemd/system/
|
dest: /etc/systemd/system/
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
with_items:
|
with_items:
|
||||||
|
- "backup-error.service"
|
||||||
- "backup-lvm.service"
|
- "backup-lvm.service"
|
||||||
- "backup-lvm.timer"
|
- "backup-lvm.timer"
|
||||||
notify: Reload systemd config
|
notify: Reload systemd config
|
||||||
|
|
6
roles/lvm_self_backup/templates/backup-error.service
Normal file
6
roles/lvm_self_backup/templates/backup-error.service
Normal 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'
|
Loading…
Add table
Reference in a new issue