Skip to content

Instantly share code, notes, and snippets.

@radimih
Created November 27, 2020 09:14
Show Gist options
  • Save radimih/822710c196a1c8335bed0342d181adc7 to your computer and use it in GitHub Desktop.
Save radimih/822710c196a1c8335bed0342d181adc7 to your computer and use it in GitHub Desktop.
Ansible: stop systemd service if exists
- 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