refactor systemd playbooks

This commit is contained in:
Gabriel Augendre 2024-10-17 17:32:09 +02:00
parent 7e5807e009
commit 1d74e9609b
4 changed files with 6 additions and 14 deletions

View file

@ -33,13 +33,12 @@
- name: Write service unit file - name: Write service unit file
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: templates/goatcounter.service.j2 src: templates/goatcounter/goatcounter.service.j2
dest: /etc/systemd/system/goatcounter.service dest: /etc/systemd/system/goatcounter.service
mode: "0600" mode: "0600"
owner: root owner: root
group: root group: root
notify: notify:
- Daemon-reload
- Restart service - Restart service
- name: Flush handlers - name: Flush handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
@ -51,15 +50,12 @@
enabled: true enabled: true
handlers: handlers:
- name: Daemon-reload
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart service - name: Restart service
become: true become: true
ansible.builtin.service: ansible.builtin.systemd:
name: goatcounter name: goatcounter
state: restarted state: restarted
daemon_reload: true
vars: vars:
ansible_python_interpreter: /tmp/ansible/bin/python ansible_python_interpreter: /tmp/ansible/bin/python

View file

@ -6,13 +6,12 @@
- name: Write service file - name: Write service file
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: templates/lyon-transports.service.j2 src: templates/lyon-transports/lyon-transports.service.j2
dest: /etc/systemd/system/lyon-transports.service dest: /etc/systemd/system/lyon-transports.service
mode: "0600" mode: "0600"
owner: root owner: root
group: root group: root
notify: notify:
- Reload daemon
- Restart service - Restart service
- name: Flush handlers - name: Flush handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
@ -24,15 +23,12 @@
enabled: true enabled: true
handlers: handlers:
- name: Reload daemon
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart service - name: Restart service
become: true become: true
ansible.builtin.service: ansible.builtin.systemd:
name: lyon-transports name: lyon-transports
state: restarted state: restarted
daemon_reload: true
vars: vars:
dir: /mnt/data/lyon-transports dir: /mnt/data/lyon-transports