mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
attempt to add service to chkconfig when suggested
This commit is contained in:
@@ -464,6 +464,9 @@ class LinuxService(Service):
|
||||
|
||||
if self.enable_cmd.endswith("chkconfig"):
|
||||
(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:
|
||||
self.module.exit_json(msg="unknown service name")
|
||||
state = out.split()[-1]
|
||||
|
||||
Reference in New Issue
Block a user