mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
attempt to add service to chkconfig when suggested
This commit is contained in:
parent
2e797a5155
commit
f1829a0f86
1 changed files with 3 additions and 0 deletions
|
@ -464,6 +464,9 @@ class LinuxService(Service):
|
||||||
|
|
||||||
if self.enable_cmd.endswith("chkconfig"):
|
if self.enable_cmd.endswith("chkconfig"):
|
||||||
(rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
|
(rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
|
||||||
|
if 'chkconfig --add %s' % self.name in err:
|
||||||
|
self.execute_command("%s --add %s" % (self.enable_cmd, self.name))
|
||||||
|
(rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
|
||||||
if not self.name in out:
|
if not self.name in out:
|
||||||
self.module.exit_json(msg="unknown service name")
|
self.module.exit_json(msg="unknown service name")
|
||||||
state = out.split()[-1]
|
state = out.split()[-1]
|
||||||
|
|
Loading…
Reference in a new issue