Created
November 27, 2020 09:14
-
-
Save radimih/822710c196a1c8335bed0342d181adc7 to your computer and use it in GitHub Desktop.
Ansible: stop systemd service if exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Disable and stoping service if exists | |
systemd: | |
service: "{ service name }" | |
enabled: no | |
state: stopped | |
register: result_systemd_stop | |
failed_when: "result_systemd_stop is failed and 'Could not find the requested service' not in result_systemd_stop.msg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I was looking for! 🙌