mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 22:51:23 -07:00
fixed enabled state
This commit is contained in:
parent
df1b03d0c6
commit
cffe358260
1 changed files with 4 additions and 1 deletions
|
@ -309,6 +309,9 @@ def main():
|
||||||
if rc == 0 or (os.access(initscript, os.X_OK) and bool(glob.glob('/etc/rc?.d/S??' + unit))):
|
if rc == 0 or (os.access(initscript, os.X_OK) and bool(glob.glob('/etc/rc?.d/S??' + unit))):
|
||||||
enabled = True
|
enabled = True
|
||||||
|
|
||||||
|
# default to current state
|
||||||
|
result['enabled'] = enabled
|
||||||
|
|
||||||
# Change enable/disable if needed
|
# Change enable/disable if needed
|
||||||
if enabled != module.params['enabled']:
|
if enabled != module.params['enabled']:
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
|
@ -322,7 +325,7 @@ def main():
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg="Unable to %s service %s: %s" % (action, unit, err))
|
module.fail_json(msg="Unable to %s service %s: %s" % (action, unit, err))
|
||||||
|
|
||||||
result['enabled'] = enabled
|
result['enabled'] = not enabled
|
||||||
|
|
||||||
if module.params['state'] is not None:
|
if module.params['state'] is not None:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue