|
|
@ -132,14 +132,14 @@ def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec = dict(
|
|
|
|
argument_spec = dict(
|
|
|
|
name = dict(required=True),
|
|
|
|
name = dict(required=True),
|
|
|
|
state = dict(required=True, choices=['running', 'started', 'stopped', 'restarted', 'reloaded']),
|
|
|
|
state = dict(choices=['running', 'started', 'stopped', 'restarted', 'reloaded']),
|
|
|
|
enable = dict(choices=BOOLEANS)
|
|
|
|
enabled = dict(choices=BOOLEANS)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
name = module.params['name']
|
|
|
|
name = module.params['name']
|
|
|
|
state = module.params['state']
|
|
|
|
state = module.params['state']
|
|
|
|
enable = module.boolean(module.params.get('enable', None))
|
|
|
|
enable = module.boolean(module.params.get('enabled', None))
|
|
|
|
|
|
|
|
|
|
|
|
# ===========================================
|
|
|
|
# ===========================================
|
|
|
|
# find binaries locations on minion
|
|
|
|
# find binaries locations on minion
|
|
|
@ -156,8 +156,10 @@ def main():
|
|
|
|
err = ''
|
|
|
|
err = ''
|
|
|
|
out = ''
|
|
|
|
out = ''
|
|
|
|
|
|
|
|
|
|
|
|
if enable:
|
|
|
|
if module.params['enabled']:
|
|
|
|
rc_enable, out_enable, err_enable = _do_enable(name, enable)
|
|
|
|
rc_enable, out_enable, err_enable = _do_enable(name, enable)
|
|
|
|
|
|
|
|
if rc == 0:
|
|
|
|
|
|
|
|
changed = True
|
|
|
|
rc += rc_enable
|
|
|
|
rc += rc_enable
|
|
|
|
out += out_enable
|
|
|
|
out += out_enable
|
|
|
|
err += err_enable
|
|
|
|
err += err_enable
|
|
|
@ -201,6 +203,10 @@ def main():
|
|
|
|
module.fail_json(msg=err)
|
|
|
|
module.fail_json(msg=err)
|
|
|
|
|
|
|
|
|
|
|
|
result = {"changed": changed}
|
|
|
|
result = {"changed": changed}
|
|
|
|
|
|
|
|
if module.params['enabled']:
|
|
|
|
|
|
|
|
result['enabled'] = module.params['enabled']
|
|
|
|
|
|
|
|
if state:
|
|
|
|
|
|
|
|
result['state'] = state
|
|
|
|
rc, stdout, stderr = _run("%s %s status" % (SERVICE, name))
|
|
|
|
rc, stdout, stderr = _run("%s %s status" % (SERVICE, name))
|
|
|
|
module.exit_json(**result);
|
|
|
|
module.exit_json(**result);
|
|
|
|
|
|
|
|
|
|
|
|