mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
allow more than .service, onus on user
This commit is contained in:
parent
2f0070639f
commit
fa93bf7096
1 changed files with 3 additions and 7 deletions
|
@ -33,7 +33,7 @@ options:
|
||||||
name:
|
name:
|
||||||
required: true
|
required: true
|
||||||
description:
|
description:
|
||||||
- Name of the service.
|
- Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
|
||||||
aliases: ['unit', 'service']
|
aliases: ['unit', 'service']
|
||||||
state:
|
state:
|
||||||
required: false
|
required: false
|
||||||
|
@ -330,12 +330,8 @@ def main():
|
||||||
|
|
||||||
elif out.find('ignoring request') != -1:
|
elif out.find('ignoring request') != -1:
|
||||||
# fallback list-unit-files as show does not work on some systems (chroot)
|
# fallback list-unit-files as show does not work on some systems (chroot)
|
||||||
# not used as primary as it skips some services (like those using init.d) and requires .service notation
|
# not used as primary as it skips some services (like those using init.d) and requires .service/etc notation
|
||||||
if unit.endswith('.service'):
|
(rc, out, err) = module.run_command("%s list-unit-files '%s'" % (systemctl, unit))
|
||||||
service = unit
|
|
||||||
else:
|
|
||||||
service = '%s.service' % unit
|
|
||||||
(rc, out, err) = module.run_command("%s list-unit-files '%s'" % (systemctl, service))
|
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
is_systemd = True
|
is_systemd = True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue