systemd: Start inactive units for reload/restart

The `service` module starts services that are not running when
`action=restarted` or `action=reloaded`, which is especially convenient
for initial deployments because it eliminates an extraneous operation
for when the service starts for the first time. This commit adjusts the
behavior of the `systemd` module to match.
pull/18777/head
Dustin C. Hatch 8 years ago committed by Matt Clay
parent ce0412aa85
commit b49aa70c29

@ -384,7 +384,10 @@ def main():
if result['status']['ActiveState'] == 'active':
action = 'stop'
else:
action = module.params['state'][:-2] # remove 'ed' from restarted/reloaded
if result['status']['ActiveState'] != 'active':
action = 'start'
else:
action = module.params['state'][:-2] # remove 'ed' from restarted/reloaded
result['state'] = 'started'
if action:

Loading…
Cancel
Save