summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/system/service.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/modules/system/service.py')
-rw-r--r--lib/ansible/modules/system/service.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py
index 7e5199d868..8c6ae75d88 100644
--- a/lib/ansible/modules/system/service.py
+++ b/lib/ansible/modules/system/service.py
@@ -490,7 +490,7 @@ class LinuxService(Service):
self.upstart_version = LooseVersion('0.0.0')
try:
version_re = re.compile(r'\(upstart (.*)\)')
- rc,stdout,stderr = self.module.run_command('initctl version')
+ rc,stdout,stderr = self.module.run_command('%s version' % location['initctl'])
if rc == 0:
res = version_re.search(stdout)
if res:
@@ -498,9 +498,7 @@ class LinuxService(Service):
except:
pass # we'll use the default of 0.0.0
- if location.get('start', False):
- # upstart -- rather than being managed by one command, start/stop/restart are actual commands
- self.svc_cmd = ''
+ self.svc_cmd = location['initctl']
elif location.get('rc-service', False):
# service is managed by OpenRC
@@ -922,8 +920,13 @@ class LinuxService(Service):
arguments = self.arguments
if self.svc_cmd:
if not self.svc_cmd.endswith("systemctl"):
- # SysV and OpenRC take the form <cmd> <name> <action>
- svc_cmd = "%s %s" % (self.svc_cmd, self.name)
+ if self.svc_cmd.endswith("initctl"):
+ # initctl commands take the form <cmd> <action> <name>
+ svc_cmd = self.svc_cmd
+ arguments = "%s %s" % (self.name, arguments)
+ else:
+ # SysV and OpenRC take the form <cmd> <name> <action>
+ svc_cmd = "%s %s" % (self.svc_cmd, self.name)
else:
# systemd commands take the form <cmd> <action> <name>
svc_cmd = self.svc_cmd