From 1d74e9609b7aa193d044577abeef7e64d65ff390 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 17 Oct 2024 17:32:09 +0200 Subject: [PATCH] refactor systemd playbooks --- playbooks/apps/goatcounter.yaml | 10 +++------- playbooks/apps/lyon-transports.yaml | 10 +++------- .../templates/{ => goatcounter}/goatcounter.service.j2 | 0 .../{ => lyon-transports}/lyon-transports.service.j2 | 0 4 files changed, 6 insertions(+), 14 deletions(-) rename playbooks/apps/templates/{ => goatcounter}/goatcounter.service.j2 (100%) rename playbooks/apps/templates/{ => lyon-transports}/lyon-transports.service.j2 (100%) diff --git a/playbooks/apps/goatcounter.yaml b/playbooks/apps/goatcounter.yaml index 45a9732..d62b32d 100644 --- a/playbooks/apps/goatcounter.yaml +++ b/playbooks/apps/goatcounter.yaml @@ -33,13 +33,12 @@ - name: Write service unit file become: true ansible.builtin.template: - src: templates/goatcounter.service.j2 + src: templates/goatcounter/goatcounter.service.j2 dest: /etc/systemd/system/goatcounter.service mode: "0600" owner: root group: root notify: - - Daemon-reload - Restart service - name: Flush handlers ansible.builtin.meta: flush_handlers @@ -51,15 +50,12 @@ enabled: true handlers: - - name: Daemon-reload - become: true - ansible.builtin.systemd: - daemon_reload: true - name: Restart service become: true - ansible.builtin.service: + ansible.builtin.systemd: name: goatcounter state: restarted + daemon_reload: true vars: ansible_python_interpreter: /tmp/ansible/bin/python diff --git a/playbooks/apps/lyon-transports.yaml b/playbooks/apps/lyon-transports.yaml index a190342..1a7a8f5 100644 --- a/playbooks/apps/lyon-transports.yaml +++ b/playbooks/apps/lyon-transports.yaml @@ -6,13 +6,12 @@ - name: Write service file become: true ansible.builtin.template: - src: templates/lyon-transports.service.j2 + src: templates/lyon-transports/lyon-transports.service.j2 dest: /etc/systemd/system/lyon-transports.service mode: "0600" owner: root group: root notify: - - Reload daemon - Restart service - name: Flush handlers ansible.builtin.meta: flush_handlers @@ -24,15 +23,12 @@ enabled: true handlers: - - name: Reload daemon - become: true - ansible.builtin.systemd: - daemon_reload: true - name: Restart service become: true - ansible.builtin.service: + ansible.builtin.systemd: name: lyon-transports state: restarted + daemon_reload: true vars: dir: /mnt/data/lyon-transports diff --git a/playbooks/apps/templates/goatcounter.service.j2 b/playbooks/apps/templates/goatcounter/goatcounter.service.j2 similarity index 100% rename from playbooks/apps/templates/goatcounter.service.j2 rename to playbooks/apps/templates/goatcounter/goatcounter.service.j2 diff --git a/playbooks/apps/templates/lyon-transports.service.j2 b/playbooks/apps/templates/lyon-transports/lyon-transports.service.j2 similarity index 100% rename from playbooks/apps/templates/lyon-transports.service.j2 rename to playbooks/apps/templates/lyon-transports/lyon-transports.service.j2