From df1b03d0c62eb2a516bef7d7d52bd97d0325a0db Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 1 Jun 2016 12:30:20 -0400 Subject: [PATCH] fixed reported state --- lib/ansible/modules/system/systemd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/systemd.py b/lib/ansible/modules/system/systemd.py index 7dbd695b114..03b7853f784 100644 --- a/lib/ansible/modules/system/systemd.py +++ b/lib/ansible/modules/system/systemd.py @@ -325,6 +325,10 @@ def main(): result['enabled'] = enabled if module.params['state'] is not None: + + # default to desired state + result['state'] = module.params['state'] + # What is current service state? if 'ActiveState' in result['status']: action = None @@ -338,6 +342,7 @@ def main(): result['changed'] = True else: action = module.params['state'][:-2] # remove 'ed' from restarted/reloaded + result['state'] = 'started' result['changed'] = True if action: @@ -349,7 +354,6 @@ def main(): # this should not happen? module.fail_json(msg="Service is in unknown state", status=result['status']) - result['state'] = module.params['state'] module.exit_json(**result)