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