Unable to change MPM module with apache2_module #5328
Comments
@jimmymccrory Thanks for testing and reporting this bug. Did your playbook work with previous ansible versions? The usage of A potential fix would be to somehow "force" the enable/disable step and ignore the error messages or to try to do both modules simultaneously. Both aspects are not covered by the module so far, so I would call this a feature request and not a bug. |
@n0trax What's your take on this issue? |
@jimmymccrory the test was added to implement the check-mode for the apache module. Versions prior 2.2 does not have this test. @robinro offTopic: |
@n0trax with a function that provides 'a2query' binary. Proper switch for that module is '-m'. |
Agreed with @michaelgugino there. |
@n0trax If you don't do the first check, you can't determine the changed state, which kills idempotency. I would then not call it Whatever solution we choose, it has to work with all distributions that are supported at the moment. opensuse 42.1 does not have I would leave the syntax checking on by default, since it might be helpful to prevent misconfiguration, but we can add an option to disable it. |
needs_contributor |
Here's an approach I think will work: Use a2enmod or a2dismod for the requested action (no pre-check needed). Check for 'Module already enabled' or 'Module mpm_event already disabled' respectively. This should cover all use cases, as long as stdout message is the same between distros. I'm happy to cut a patch for this if needed. |
@michaelgugino Have a look at the discussion and diff at It turns out the stdout content depends on the distribution, see e.g. https://github.com/ansible/ansible-modules-core/pull/2091/files Then for some modules (like cgi) there is special output to deal with... There was a good reason to check the module list instead. Why not fix that up? See my comment above in #5328 (comment) |
@robinro I think parsing the stdout (not the return code, return code is 0 for already enabled/disabled) is a good compromise if some distros don't ship a2query. I think adding the re checks to stdout from https://github.com/ansible/ansible-modules-core/pull/2091/files is the correct approach. You can leave the _module_is_enabled function in place as-is for check mode, but don't use it otherwise. |
@michaelgugino I just wanted to make sure you are aware of the previous issues, so that we don't spend time on regressions. Please open a PR so we can discuss your suggestions more concretely. |
@michaelgugino this sounds interesting. With this idea we have the check mode working and we don't have to deal with this apache error. |
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state.
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state.
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
Please also have a look at #5455 when you try to fix this issue. Maybe we can have a general workaround for broken apache configs/inconsistent state. |
@robinro It looks like my patch will fix this issue as well, except for when running check_mode. That's probably an edge case that we can live with until ubuntu fixes their packages. |
The apache2_module module in Ansible 2.2 is much more strict around configuration syntax checks and contains a bug [0] preventing MPM modules from being changed. Move the enabling of apache2 modules ahead of writing configurations and temporarily use the command module to enable/disable apache2 modules until this issue is resolved. [0] ansible/ansible-modules-core#5328 Change-Id: I65ffc016b594ebe0d61d1355364d222d0082ee63
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
Created validation patchset: ansible/ansible#18371 |
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
The apache2_module module in Ansible 2.2 is much more strict around configuration syntax checks [0] [1]. Temporarily use the command module to enable/disable apache2 modules until this issue is resolved. Also combine the enabling of apache2 modules into a single task and move it ahead of writing apache configurations. [0] ansible/ansible-modules-core#5328 [1] ansible/ansible-modules-core#5455 Change-Id: If59127a66a0349fde00912d64ff79762b0661859
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between certain modules, such as mpm_worker and mpm_event. This change only parses apache's configs during check mode, otherwise it parses the stdout results of attempted to enabled or disable modules to determine change state. Fixes ansible#5328
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between mpm modules, such as mpm_worker and mpm_event. This change accounts for the specific error condition raised by ``apachectl -M``: ``AH00534: apache2: Configuration error: No MPM loaded.`` When loading or unloading a module with a name that contains 'mpm_', apache2_module will ignore the error raised by apachectl if stderr contains 'AH00534'. Fixes ansible#5328
Ignore configuration checks about inconsistent module configuration. Especially for mpm_* modules. Fixes ansible#5328
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between mpm modules, such as mpm_worker and mpm_event. This change accounts for the specific error condition raised by ``apachectl -M``: ``AH00534: apache2: Configuration error: No MPM loaded.`` When loading or unloading a module with a name that contains 'mpm_', apache2_module will ignore the error raised by apachectl if stderr contains 'AH00534'. Fixes ansible#5328
This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo. |
Currently, the apache2_module module parses apache configs for correctness when enabling or disabling apache2 modules. This behavior introduced a conflict condition when transitioning between mpm modules, such as mpm_worker and mpm_event. This change accounts for the specific error condition raised by ``apachectl -M``: ``AH00534: apache2: Configuration error: No MPM loaded.`` When loading or unloading a module with a name that contains 'mpm_', apache2_module will ignore the error raised by apachectl if stderr contains 'AH00534'. Fixes ansible#5328
This is now fixed in devel (one needs to set ignore_configcheck: True) to get to the old behavior. |
The apache2_module module in Ansible 2.2 is much more strict around configuration syntax checks and contains a bug [0] preventing MPM modules from being changed. Move the enabling of apache2 modules ahead of writing configurations and temporarily use the command module to enable/disable apache2 modules until this issue is resolved. [0] ansible/ansible-modules-core#5328 Change-Id: I65ffc016b594ebe0d61d1355364d222d0082ee63
Error executing /usr/sbin/apache2ctl: AH00534: apache2: Configuration error: No MPM loaded. Turns out it was a bug in Ansible 2.2 ansible/ansible-modules-core#5328 Signed-off-by: Mariano Barcia <mariano.barcia@gmail.com>
The upstream bug ansible/ansible-modules-core#5328 has been fixed so remove the workaround and use the Ansible module directly. Link: ansible/ansible-modules-core#5328 Change-Id: Ibf50de533af3225654fe5215a83feab55494051e
The upstream bug ansible/ansible-modules-core#5328 has been fixed so remove the workaround and use the Ansible module directly. Moreover, we also need to set 'ignore_configcheck: yes' to ignore the apachectl warnings whe disabling the mpm_* modules. Link: ansible/ansible-modules-core#5328 Change-Id: I20bd0cf6148794c7a6342c3f7eda444cbb715e06
This issue was migrated to ansible/ansible#29565 |
ISSUE TYPE
COMPONENT NAME
apache2_module module
ANSIBLE VERSION
OS / ENVIRONMENT
Ubuntu 14.04
SUMMARY
The initial check of currently enabled modules performed by apache2ctl can prevent modules from being enabled or disabled.
STEPS TO REPRODUCE
EXPECTED RESULTS
Modules being successfully enabled and disabled.
ACTUAL RESULTS
Flipping the order of the modules also fails.
The text was updated successfully, but these errors were encountered: