1
0
Fork 0
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:
Christian Berendt 2013-11-25 12:50:22 +01:00 committed by Michael DeHaan
parent b8a8e9fbec
commit 9a1c1d3242

View file

@ -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))