|
|
@ -49,6 +49,9 @@ import re
|
|
|
|
def _disable_module(module):
|
|
|
|
def _disable_module(module):
|
|
|
|
name = module.params['name']
|
|
|
|
name = module.params['name']
|
|
|
|
a2dismod_binary = module.get_bin_path("a2dismod")
|
|
|
|
a2dismod_binary = module.get_bin_path("a2dismod")
|
|
|
|
|
|
|
|
if a2dismod_binary is None:
|
|
|
|
|
|
|
|
module.fail_json(msg="a2dismod not found. Perhaps this system does not use a2dismod to manage apache")
|
|
|
|
|
|
|
|
|
|
|
|
result, stdout, stderr = module.run_command("%s %s" % (a2dismod_binary, name))
|
|
|
|
result, stdout, stderr = module.run_command("%s %s" % (a2dismod_binary, name))
|
|
|
|
|
|
|
|
|
|
|
|
if re.match(r'.*' + name + r' already disabled.*', stdout, re.S):
|
|
|
|
if re.match(r'.*' + name + r' already disabled.*', stdout, re.S):
|
|
|
@ -61,6 +64,9 @@ def _disable_module(module):
|
|
|
|
def _enable_module(module):
|
|
|
|
def _enable_module(module):
|
|
|
|
name = module.params['name']
|
|
|
|
name = module.params['name']
|
|
|
|
a2enmod_binary = module.get_bin_path("a2enmod")
|
|
|
|
a2enmod_binary = module.get_bin_path("a2enmod")
|
|
|
|
|
|
|
|
if a2enmod_binary is None:
|
|
|
|
|
|
|
|
module.fail_json(msg="a2enmod not found. Perhaps this system does not use a2enmod to manage apache")
|
|
|
|
|
|
|
|
|
|
|
|
result, stdout, stderr = module.run_command("%s %s" % (a2enmod_binary, name))
|
|
|
|
result, stdout, stderr = module.run_command("%s %s" % (a2enmod_binary, name))
|
|
|
|
|
|
|
|
|
|
|
|
if re.match(r'.*' + name + r' already enabled.*', stdout, re.S):
|
|
|
|
if re.match(r'.*' + name + r' already enabled.*', stdout, re.S):
|
|
|
@ -86,4 +92,5 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
# import module snippets
|
|
|
|
# import module snippets
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
main()
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
main()
|
|
|
|