Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apache2_module fails to disable cgi module #9140

Open
1 task done
dhoffend opened this issue Nov 17, 2024 · 5 comments
Open
1 task done

apache2_module fails to disable cgi module #9140

dhoffend opened this issue Nov 17, 2024 · 5 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@dhoffend
Copy link

dhoffend commented Nov 17, 2024

Summary

Trying to disable the cgi module while running in mpm_event module will result in a failure, even when cgi module is already disabled.

Disabling the cgi module with community.general.apache2_module will fail with the error message Your MPM seems to be threaded. No automatic actions on module cgi possible.. Doing the same on the commandline with a2dismod cgi will result with the correct messaage cgi is already disabled.

In additional, the ignore_configcheck parameter gets ignored, cause the cgi detection hits earlier

Code:
github.com/ansible-collections/community.general/blob/626c0e104975f2bfe1c85e8816f4b64594e06bed//plugins/modules/apache2_module.py#L285-L287)

Possible solutions:

  • Check with a2query -m if the module in question is already enabled (this is our current workaround)
  • Check cgi operation only with state: present not absent since the problem happens only when enabling cgi module in threaded mode not the other way
  • Skip the cgi detection when ignore_configcheck is set

Issue Type

Bug Report

Component Name

apache2_module

Ansible Version

$ ansible --version
ansible [core 2.15.12]

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 7.5.2  

But the bug is also present in the current HEAD of community.general cause all operation on cgi are not allowed when threaded module is detected.

Configuration

No response

OS / Environment

Debian 11 and Debian 12

Steps to Reproduce

- name: install apache2 will default to mpm_event
  ansible.builtin.apt:
    name: apache2
    state: present

- name: Disabled already disabled cgi module
  community.general.apache2:
    name: cgi
    state: absent

Expected Results

Result should be OK not FAILED since the module is already disabled

Actual Results

"Your MPM seems to be threaded. No automatic actions on module cgi possible."

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Nov 17, 2024
@russoz
Copy link
Collaborator

russoz commented Nov 17, 2024

Hi @dhoffend thanks for reporting.

Just to be on the safe side, could you please repeat the test in the latest (or a more recent) version of the collection? Version 7.x is no longer supported - latest one is 10.x already. Thanks!

@dhoffend
Copy link
Author

@russoz I can try to setup a test environment, but since I compared the HEAD code and the mentioned line with the one at 7.x I don’t expect many differences. In the head code the module execution stops before doing any other evaluation. I’ll let you know

@russoz
Copy link
Collaborator

russoz commented Nov 22, 2024

You have clearly dug deeper than me, so I am happy to take your word on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants