Role that installs apache https://httpd.apache.org
Go to file
Andrea Dell'Amico 8f69125db9
Merge branch 'el-support': the role also supports EL now.
2026-09-07 11:30:51 +02:00
defaults defaults: one apache_* namespace for both families 2026-09-04 19:54:37 +00:00
files Change the letsencrypt env path 2023-03-24 14:42:27 +01:00
handlers tasks: split the deb and EL branches 2026-09-04 19:54:37 +00:00
meta meta and README: declare EL 8 and 9, document the merge and the rename 2026-09-04 19:54:37 +00:00
tasks tasks: split the deb and EL branches 2026-09-04 19:54:37 +00:00
templates templates: the EL httpd.conf and MPM selection, with the typo fixed 2026-09-04 19:54:37 +00:00
tests Initial commit 2020-05-28 14:54:59 +02:00
vars Initial commit 2020-05-28 14:54:59 +02:00
.gitignore Initial commit 2020-05-28 14:54:59 +02:00
LICENSE Initial commit 2020-05-28 14:54:59 +02:00
README.md meta and README: declare EL 8 and 9, document the merge and the rename 2026-09-04 19:54:37 +00:00

README.md

ansible-role-apache

Installs and configures Apache httpd on Debian and Ubuntu and on EL 8 and 9. The EL side comes from the separate httpd role of the old library, absorbed here.

Variable names

There is one namespace, apache_*. The absorbed role used httpd_* and those names are gone: a playbook that still sets them has no effect. The rename is mechanical, httpd_x becomes apache_x, with four exceptions:

old new
httpd_main_packages apache_packages
httpd_ssl_enabled apache_ssl_modules_enabled
httpd_modules see Modules below
httpd_additional_modules see Modules below

Distribution differences live inside the defaults, the convention already used by ansible-role-postgresql, so every value stays a default and a playbook can still override it.

deb EL
packages apache2, apache2-utils httpd, httpd-tools
mod_ssl part of apache2 separate package
service apache2 httpd
config directory /etc/apache2 /etc/httpd
user, group www-data apache
main config file left to the package fully templated

Configuration model

The two families do not configure Apache the same way, and the role does not pretend otherwise.

On deb the packaged apache2.conf is left alone: the role manages ports.conf, removes the default virtualhost and enables modules with a2enmod.

On EL the whole httpd.conf is templated, because that is where the tuning and the document root layout live. This is what the apache_timeout, apache_keepalive_*, apache_startservers, apache_maxclients, apache_min_spare, apache_max_spare, apache_threads_per_child, apache_serverlimit and apache_max_requests_per_child variables feed, and they have no effect on deb.

Modules

On deb, modules are enabled with apache2_module, from apache_default_modules, apache_additional_modules_list, apache_ssl_modules and apache_http_proxy_modules.

On EL none of that applies. The apache2_module Ansible module requires the a2enmod and a2dismod binaries, which the EL httpd package does not ship, so the httpd_modules list of the absorbed role could never be applied there. What EL needs is the MPM selection, written to conf.modules.d/00-mpm.conf from apache_mpm_mode, while the individual LoadModule lines come from the distributions own conf.modules.d. apache_el_extra_modules adds the ones the distribution does not load by default:

apache_el_extra_modules:
  - { identifier: 'jk_module', file: 'mod_jk.so' }

Handlers

apache2 reload and apache2 restart act on the right service on both families. httpd reload and httpd restart exist as well, with the same behaviour, for the roles that come from the absorbed one and notify those names.