1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Check if a service exists

This commit is contained in:
Igor Khomyakov 2015-01-09 16:57:20 +03:00 committed by Matt Clay
parent b6258a1e4c
commit 03483d2ea5

View file

@ -194,9 +194,14 @@ def main():
if state == 'restarted':
rc, out, err = run_supervisorctl('update', check_rc=True)
processes = get_matched_processes()
if not processes:
module.fail_json(name=name, msg="ERROR (no such process)")
take_action_on_processes(processes, lambda s: True, 'restart', 'started')
processes = get_matched_processes()
if not processes:
module.fail_json(name=name, msg="ERROR (no such process)")
if state == 'present':
if len(processes) > 0: