From 286021056f9700ab58fae92d03d9555300aef580 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 30 Nov 2016 10:02:08 -0600 Subject: 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. --- system/systemd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/systemd.py b/system/systemd.py index 19fedce4..dcc493b8 100644 --- a/system/systemd.py +++ b/system/systemd.py @@ -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: -- cgit v1.2.1