community.general.apache2_module (8.5.0) — module

Enables/disables a module of the Apache2 webserver

Authors: Christian Berendt (@berendt), Ralf Hertel (@n0trax), Robin Roth (@robinro)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Enables or disables a specified module of the Apache2 webserver.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable the Apache2 module wsgi
  community.general.apache2_module:
    state: present
    name: wsgi
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disables the Apache2 module wsgi
  community.general.apache2_module:
    state: absent
    name: wsgi
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable default modules for Debian
  community.general.apache2_module:
    state: absent
    name: autoindex
    force: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable mpm_worker and ignore warnings about missing mpm module
  community.general.apache2_module:
    state: absent
    name: mpm_worker
    ignore_configcheck: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable mpm_event, enable mpm_prefork and ignore warnings about missing mpm module
  community.general.apache2_module:
    name: "{{ item.module }}"
    state: "{{ item.state }}"
    warn_mpm_absent: false
    ignore_configcheck: true
  loop:
  - module: mpm_event
    state: absent
  - module: mpm_prefork
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable dump_io module, which is identified as dumpio_module inside apache2
  community.general.apache2_module:
    state: present
    name: dump_io
    identifier: dumpio_module

Inputs

    
name:
    description:
    - Name of the module to enable/disable as given to C(a2enmod/a2dismod).
    required: true
    type: str

force:
    default: false
    description:
    - Force disabling of default modules and override Debian warnings.
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Desired state of the module.
    type: str

identifier:
    description:
    - Identifier of the module as listed by C(apache2ctl -M). This is optional and usually
      determined automatically by the common convention of appending V(_module) to O(name)
      as well as custom exception for popular modules.
    required: false
    type: str

warn_mpm_absent:
    default: true
    description:
    - Control the behavior of the warning process for MPM modules.
    type: bool
    version_added: 6.3.0
    version_added_collection: community.general

ignore_configcheck:
    default: false
    description:
    - Ignore configuration checks about inconsistent module configuration. Especially
      for mpm_* modules.
    type: bool

Outputs

rc:
  description: return code of underlying command
  returned: failed
  type: int
result:
  description: message about action taken
  returned: always
  type: str
stderr:
  description: stderr of underlying command
  returned: failed
  type: str
stdout:
  description: stdout of underlying command
  returned: failed
  type: str
warnings:
  description: list of warning messages
  returned: when needed
  type: list