diff --git a/roles/lvm_self_backup/tasks/main.yml b/roles/lvm_self_backup/tasks/main.yml index a9640c2..7466d54 100644 --- a/roles/lvm_self_backup/tasks/main.yml +++ b/roles/lvm_self_backup/tasks/main.yml @@ -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 diff --git a/roles/lvm_self_backup/templates/backup-error.service b/roles/lvm_self_backup/templates/backup-error.service new file mode 100644 index 0000000..14e7dbe --- /dev/null +++ b/roles/lvm_self_backup/templates/backup-error.service @@ -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'