Repository: ansible-collections/community.general

Issue:
Apache2 module workaround for Shibboleth needs updating
##### SUMMARY

The workaround for Shibboleth previously added in [#20341](https://github.com/ansible/ansible/pull/20341) no longer works (on Debian 10) since the module *name* has meanwhile been changed from `shib2` (for which a workaround [currently exists](https://github.com/ansible-collections/community.general/blob/a1c03a3cfea17fdecf7b333a4f5665707283875d/plugins/modules/web_infrastructure/apache2_module.py#L161)) to `shib` (to account for the increasingly unfortunate naming `shib2` when the software currently has a major version of 3) which is not covered by the workaround.

Since [upstream is unable to change the module identifer](https://issues.shibboleth.net/jira/browse/SSPCPP-718) (easily, without causing breakage) the obvious and simple fix would be to amend the existing workaround to *also* match the current (and likely to remain that way in the future) module name, taking into account that different versions of the module may be in use:

```diff
# web_infrastructure/apache2_module.py
    # a2enmod name replacement to apache2ctl -M names
    text_workarounds = [
-       ('shib2', 'mod_shib'),
+       ('shib', 'mod_shib'),
+       ('shib2', 'mod_shib'),
        ('evasive', 'evasive20_module'),
    ]
```

Once (if ever) the module identifier changes upstream to match the Apache httpd convension the workaround can be removed.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
apache2_module

##### ANSIBLE VERSION

Current `main` branch.

##### STEPS TO REPRODUCE
See [#20288](https://github.com/ansible/ansible/issues/20288), i.e., the behaviour matches the pre-workaround one exactly since the module name is no longer matched.  
Ansible again fails with "Maybe the module identifier (shib) was guessed incorrectly":

```yaml
failed: [filesender.lab.aco.net] (item=shib) => changed=false 
  ansible_loop_var: item
  item: shib
  msg: |-
    Failed to set module   shib
     to enabled:
    Module shib already enabled
  
    Maybe the module identifier (shib) was guessed incorrectly.Consider setting the "identifier" option.
  rc: 0
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    Module shib already enabled
  stdout_lines: <omitted>
```


Discussion:
Files identified in the description:
* [`plugins/modules/web_infrastructure/apache2_module.py`](https://github.com/ansible-collections/community.general/blob/master/plugins/modules/web_infrastructure/apache2_module.py)

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

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @berendt @n0trax @nerzhul @robinro
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Feel free to create a PR. (If you do, please include a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to).)
> Feel free to create a PR. (If you do, please include a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to).)

@felixfontein: Btw, how would I create a changelog fragment named after the PR number ("To create a changelog entry, create a new file with a unique name in the changelogs/fragments/ directory of the corresponding repository. The file name should include the PR number") when I add and commit the fragment file before ever creating the PR and hence don't know the PR number at the time I commit the changes? Create file with bogus name, commit, create PR with bogus file name, git rename file based on assignd PR number, push changes to feature branch, possibly forcing push? All that for a single line PR?

Resolving patch:
diff --git a/plugins/modules/web_infrastructure/apache2_module.py b/plugins/modules/web_infrastructure/apache2_module.py
--- a/plugins/modules/web_infrastructure/apache2_module.py
+++ b/plugins/modules/web_infrastructure/apache2_module.py
@@ -161,6 +161,7 @@ def create_apache_identifier(name):
 
     # a2enmod name replacement to apache2ctl -M names
     text_workarounds = [
+        ('shib', 'mod_shib'),
         ('shib2', 'mod_shib'),
         ('evasive', 'evasive20_module'),
     ]


Test patch: