From f7d5f7533e5bd3db61c86263acd4906ff17b725d Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 30 Dec 2024 18:44:03 +0100 Subject: [PATCH] restic --- roles/mgrote_restic/tasks/main.yml | 58 +++++------------------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/roles/mgrote_restic/tasks/main.yml b/roles/mgrote_restic/tasks/main.yml index 39be585c..b49dd5e5 100644 --- a/roles/mgrote_restic/tasks/main.yml +++ b/roles/mgrote_restic/tasks/main.yml @@ -51,63 +51,23 @@ mode: "0600" no_log: "{{ no_debug | default('true') }}" -- name: template restic.mount +- name: Ensure systemd services are templated become: true ansible.builtin.template: - src: media-restic.mount.j2 - dest: /etc/systemd/system/media-restic.mount # media-restic == /media/restic + src: "{{ item }}.j2" + dest: /etc/systemd/system/{{ item }} owner: root group: root mode: "0644" notify: - systemctl daemon-reload - systemctl enable units - -- name: template restic.automount - become: true - ansible.builtin.template: - src: media-restic.automount.j2 - dest: /etc/systemd/system/media-restic.automount - owner: root - group: root - mode: "0644" - notify: - - systemctl daemon-reload - - systemctl enable units - - systemctl start units - -- name: template restic.service - become: true - ansible.builtin.template: - src: restic.service.j2 - dest: /etc/systemd/system/restic.service - owner: root - group: root - mode: "0644" - notify: - - systemctl daemon-reload - -- name: template restic.timer - become: true - ansible.builtin.template: - src: restic.timer.j2 - dest: /etc/systemd/system/restic.timer - owner: root - group: root - mode: "0644" - notify: - - systemctl daemon-reload - -- name: template restic_mail.service - become: true - ansible.builtin.template: - src: "restic_mail.service.j2" - dest: /etc/systemd/system/restic_mail.service - owner: root - group: root - mode: "0644" - notify: - - systemctl daemon-reload + loop: + - media-restic.mount # media-restic == /media/restic + - media-restic.automount # media-restic == /media/restic + - restic.service + - restic.timer + - restic_mail.service - name: systemctl start restic.timer become: true