mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
use module.get_bin_path() for a2enmod
This commit is contained in:
parent
b8a8e9fbec
commit
9a1c1d3242
1 changed files with 4 additions and 2 deletions
|
@ -45,7 +45,8 @@ EXAMPLES = '''
|
|||
|
||||
def _module_is_enabled(module):
|
||||
name = module.params['name']
|
||||
result, stdout, stderr = module.run_command("a2enmod -q %s" % name)
|
||||
a2enmod_binary = module.get_bin_path("a2enmod")
|
||||
result, stdout, stderr = module.run_command("%s -q %s" % (a2enmod_binary, name))
|
||||
return result == 0
|
||||
|
||||
def _module_is_disabled(module):
|
||||
|
@ -69,7 +70,8 @@ def _enable_module(module):
|
|||
if _module_is_enabled(module):
|
||||
module.exit_json(changed = False, result = "Success")
|
||||
|
||||
result, stdout, stderr = module.run_command("a2enmod %s" % name)
|
||||
a2enmod_binary = module.get_bin_path("a2enmod")
|
||||
result, stdout, stderr = module.run_command("%s %s" % (a2enmod_binary, name))
|
||||
if result != 0:
|
||||
module.fail_json(msg="Failed to enable module %s: %s" % (name, stdout))
|
||||
|
||||
|
|
Loading…
Reference in a new issue