Ansible Role linuxfabrik.lfops.mod_maxminddb¶
This role downloads, compiles and installs the Maxmind module mod_maxminddb for Apache httpd. The resulting mod_maxminddb.so is placed where Apache expects it on the target distribution:
- Red Hat-family:
/usr/lib64/httpd/modules/mod_maxminddb.so - Debian / Ubuntu:
/usr/lib/apache2/modules/mod_maxminddb.so
For Maxmind, depending on your needs, you normally run three playbooks in this particular order:
- libmaxminddb
- mod_maxminddb (this role)
- maxmind_geoip
Available since LFOps 2.0.0.
How the Role Behaves¶
-
Build dependencies are OS-specific:
- Red Hat-family:
gcc,httpd-devel,make,redhat-rpm-config,tar. - Debian / Ubuntu:
apache2-dev,gcc,make,tar(noredhat-rpm-config; that package is RH-only).
- Red Hat-family:
-
The Tarball is fetched on the Ansible controller (
delegate_to: 'localhost',run_once: true), then copied to the target. The controller therefore needs Internet access to GitHub; the target does not. ./configure && make installis executed in~/mod_maxminddb-<version>/.make installerrors are ignored becauseapxs-basedLoadModuleactivation often fails on a default Apache config; the compiled.sois what we care about.- The
LoadModuledirective is written tomod_maxminddb__apache_conf_modules_d(default is OS-specific, see variable below) and points to the OS-specific module path listed above. - On Debian / Ubuntu the role additionally runs the equivalent of
a2enmod maxminddb(viacommunity.general.apache2_module) so the freshly placed.loadfile gets symlinked into/etc/apache2/mods-enabled/. On Red Hat-family hosts the module is picked up automatically because it lives in/etc/httpd/conf.modules.d/.
Requirements¶
- Apache httpd must be installed, with at least one
LoadModuledirective already present (role: linuxfabrik.lfops.apache_httpd). Otherwise the compile step may fail withapxs:Error: At least one 'LoadModule' directive already has to exist... See "How the Role Behaves" for whymake installerrors are ignored.
Tags¶
mod_maxminddb
- Installs the build toolchain, downloads, compiles and installs
mod_maxminddb, and writes the correspondingLoadModuledirective. - Triggers: none.
Optional Role Variables¶
mod_maxminddb__apache_conf_modules_d
- Path and filename for the
LoadModuledirective. - Type: String.
-
Default (OS-specific):
- Red Hat-family:
'/etc/httpd/conf.modules.d/20-mod_maxminddb.conf' - Debian / Ubuntu:
'/etc/apache2/mods-available/maxminddb.load'
- Red Hat-family:
mod_maxminddb__version
- The version to install. Possible options: https://github.com/maxmind/mod_maxminddb/releases.
- Type: String.
- Default:
'1.2.0'
Example:
# optional
mod_maxminddb__apache_conf_modules_d: '/etc/httpd/conf-available/mod_maxminddb.conf'
mod_maxminddb__version: '1.2.0'