mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
ce0412aa85
commit
b49aa70c29
1 changed files with 4 additions and 1 deletions
|
@ -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…
Reference in a new issue