community.general
community.general copied to clipboard
Some options with apachectl are not working
Summary
When I try to enable an apache module on Rocky Linux 9 (RedHat), I got the following error:
"msg": "Error executing /usr/sbin/apachectl: apachectl: The "-M" option is not supported.\n"
apachectl -M doesn't work indeed, httpd -M does as expected
Issue Type
Bug Report
Component Name
apache2_module
Ansible Version
$ ansible --version
core 2.13.2
Community.general Version
$ ansible-galaxy collection list community.general
community.general 5.5.0
Configuration
$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts', '/home/martin/Projects/ansible/inventory']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/home/martin/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles', '/home/martin/Projects/ansible/roles']
OS / Environment
Rocky Linux 9
Steps to Reproduce
- name: "Enable mod_rewrite"
community.general.apache2_module:
state: present
name: rewrite
notify:
- reload httpd
- name: reload httpd
ansible.builtin.service:
name: httpd
state: reloaded
Expected Results
I expect that the command to list modules in apache works as expected
Actual Results
redirecting (type: modules) community.general.apache2_module to community.general.web_infrastructure.apache2_module
<195.201.151.43> ESTABLISH SSH CONNECTION FOR USER: root
<195.201.151.43> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' 195.201.151.43 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<195.201.151.43> (0, b'/root\n', b"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<195.201.151.43> ESTABLISH SSH CONNECTION FOR USER: root
<195.201.151.43> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' 195.201.151.43 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187 `" && echo ansible-tmp-1662152310.6050398-23605-76537196413187="` echo /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187 `" ) && sleep 0'"'"''
<195.201.151.43> (0, b'ansible-tmp-1662152310.6050398-23605-76537196413187=/root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187\n', b"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
redirecting (type: modules) community.general.apache2_module to community.general.web_infrastructure.apache2_module
Using module file /home/martin/.ansible/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/apache2_module.py
<195.201.151.43> PUT /home/martin/.ansible/tmp/ansible-local-234752v9lw7n8/tmpd02ym37m TO /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py
<195.201.151.43> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' '[195.201.151.43]'
<195.201.151.43> (0, b'sftp> put /home/martin/.ansible/tmp/ansible-local-234752v9lw7n8/tmpd02ym37m /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py\n', b'OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile \'~/.ssh/known_hosts\' -> \'/home/martin/.ssh/known_hosts\'\r\ndebug3: expanded UserKnownHostsFile \'~/.ssh/known_hosts2\' -> \'/home/martin/.ssh/known_hosts2\'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug2: Server supports extension "[email protected]" revision 2\r\ndebug2: Server supports extension "[email protected]" revision 2\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug2: Server supports extension "[email protected]" revision 1\r\ndebug3: Sent message [email protected] I:1\r\ndebug3: Received limits reply T:201 I:1\r\ndebug1: Using server download size 261120\r\ndebug1: Using server upload size 261120\r\ndebug1: Server handle limit 1019; using 64\r\ndebug2: Sending SSH2_FXP_REALPATH "."\r\ndebug3: Sent message fd 3 T:16 I:2\r\ndebug3: SSH2_FXP_REALPATH . -> /root\r\ndebug3: Looking up /home/martin/.ansible/tmp/ansible-local-234752v9lw7n8/tmpd02ym37m\r\ndebug2: Sending SSH2_FXP_STAT "/root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py"\r\ndebug3: Sent message fd 3 T:17 I:3\r\ndebug1: stat remote: No such file or directory\r\ndebug2: do_upload: upload local "/home/martin/.ansible/tmp/ansible-local-234752v9lw7n8/tmpd02ym37m" to remote "/root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py"\r\ndebug2: Sending SSH2_FXP_OPEN "/root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py"\r\ndebug3: Sent dest message SSH2_FXP_OPEN I:4 P:/root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py M:0x001a\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:0 S:131102\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 131102 bytes at 0\r\ndebug3: Sent message SSH2_FXP_CLOSE I:5\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<195.201.151.43> ESTABLISH SSH CONNECTION FOR USER: root
<195.201.151.43> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' 195.201.151.43 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/ /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py && sleep 0'"'"''
<195.201.151.43> (0, b'', b"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<195.201.151.43> ESTABLISH SSH CONNECTION FOR USER: root
<195.201.151.43> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' -tt 195.201.151.43 '/bin/sh -c '"'"'/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/AnsiballZ_apache2_module.py && sleep 0'"'"''
<195.201.151.43> (1, b'\r\n{"failed": true, "msg": "Error executing /usr/sbin/apachectl: apachectl: The \\"-M\\" option is not supported.\\n", "invocation": {"module_args": {"state": "present", "name": "rewrite", "force": false, "ignore_configcheck": false, "identifier": "rewrite_module"}}}\r\n', b"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to 195.201.151.43 closed.\r\n")
<195.201.151.43> Failed to connect to the host via ssh: OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 195.201.151.43 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 23483
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1
Shared connection to 195.201.151.43 closed.
<195.201.151.43> ESTABLISH SSH CONNECTION FOR USER: root
<195.201.151.43> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/martin/.ansible/cp/f5bb4524a2"' 195.201.151.43 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1662152310.6050398-23605-76537196413187/ > /dev/null 2>&1 && sleep 0'"'"''
<195.201.151.43> (0, b'', b"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 195.201.151.43 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/martin/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/martin/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23483\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
fatal: [nextcloud-test]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"force": false,
"identifier": "rewrite_module",
"ignore_configcheck": false,
"name": "rewrite",
"state": "present"
}
},
"msg": "Error executing /usr/sbin/apachectl: apachectl: The \"-M\" option is not supported.\n"
}
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
Files identified in the description: None
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
BTW, the module is called community.general.apache2_module
, and not community.general.web_infrastructure.apache2_module
. Never use that name, it's purely internal and can change at any time, even in a bugfix release.
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.
cc @berendt @n0trax click here for bot help
I have just installed a Rocky Linux VM here and checked on the apachectl
script. In fact, its man page mentions that:
Compatibility
The version of apachectl used on this system is a replacement script intended
to be mostly (but not completely) compatible with version provided with
Apache httpd. This apachectl mostly acts as a wrapper around systemctl and
manipulates the systemd service for httpd. The interface to the Apache
version of apachectl is described at
https://httpd.apache.org/docs/2.4/programs/apachectl.html.
The following differences are present in the version of apachectl present on
this system:
• Option arguments passed when starting httpd are not allowed. These should
be configured in the systemd service directly (see httpd.service(8)).
• The "fullstatus" option is not available.
• The "status" option does not use or rely on the running server's
server-status output.
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.