mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
(cherry picked from commit f2fa56b485
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
e01d014c36
commit
b9aab568f7
2 changed files with 8 additions and 4 deletions
2
changelogs/fragments/3258-apache2_module.yml
Normal file
2
changelogs/fragments/3258-apache2_module.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "apache2_module - fix ``a2enmod``/``a2dismod`` detection, and error message when not found (https://github.com/ansible-collections/community.general/issues/3253)."
|
|
@ -202,15 +202,17 @@ def _set_state(module, state):
|
|||
result=success_msg,
|
||||
warnings=module.warnings)
|
||||
|
||||
a2mod_binary = [module.get_bin_path(a2mod_binary)]
|
||||
if a2mod_binary is None:
|
||||
a2mod_binary_path = module.get_bin_path(a2mod_binary)
|
||||
if a2mod_binary_path is None:
|
||||
module.fail_json(msg="%s not found. Perhaps this system does not use %s to manage apache" % (a2mod_binary, a2mod_binary))
|
||||
|
||||
a2mod_binary_cmd = [a2mod_binary_path]
|
||||
|
||||
if not want_enabled and force:
|
||||
# force exists only for a2dismod on debian
|
||||
a2mod_binary.append('-f')
|
||||
a2mod_binary_cmd.append('-f')
|
||||
|
||||
result, stdout, stderr = module.run_command(a2mod_binary + [name])
|
||||
result, stdout, stderr = module.run_command(a2mod_binary_cmd + [name])
|
||||
|
||||
if _module_is_enabled(module) == want_enabled:
|
||||
module.exit_json(changed=True,
|
||||
|
|
Loading…
Reference in a new issue