homeserver/roles/mgrote.motd/tasks/systemctl.yml
mg a1864ad80d motd: disable service (#299)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#299
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2022-01-15 11:18:44 +01:00

34 lines
753 B
YAML

---
- name: stop units
become: yes
ansible.builtin.systemd:
name: motd-news
masked: yes
state: stopped
enabled: no
notify: systemctl_reset_failed
register: scsstop
ignore_errors: true
- name: disable units
become: yes
ansible.builtin.shell: systemctl disable motd-news
when: scsstop.changed
- name: Remove files
become: yes
ansible.builtin.file:
path:
- rm /etc/systemd/system/motd-news
- rm /usr/lib/systemd/system/motd-news
state: absent
- name: force systemd to reread configs
become: yes
ansible.builtin.systemd:
daemon_reload: yes
when: scsstop.changed
# https://superuser.com/questions/513159/how-to-remove-systemd-services