Ask Your Question

puppetlabs/apache How to control which modules get loaded ?

asked 2016-04-01 09:46:27 -0500

vw gravatar image

updated 2016-04-01 10:58:28 -0500

I am new to Apache httpd and new to Puppet.

The Puppet Forge module puppetlabs/apache works beautifully for installing and running Apache httpd 2.4.6, this is the off the shelf version from Oracle's Linux 7.1 repo.

To get version 2.4.18 configured and running, I built an RPM from Apache's httpd-2.4.18.tar.bz2, stored it in a yum repo and tried again using puppetlabs/apache.

It installs OK but doesn't run, it fails trying to load two missing modules:

If I manually configure these out and do a manual start, it runs OK.

Whilst is probably good to have, there are modules that I don't want/need and is one of them.

I note that the httpd.conf file included in the RPM is 519 lines long, 112 of the lines are LoadModule statements, many of them commented out e.g.

LoadModule mime_module lib64/httpd/modules/
#LoadModule ldap_module lib64/httpd/modules/

The httpd.conf file installed by puppetlabs/apache looks very different, only 49 lines in length and the module loading is all done using a single line:

Include "/etc/httpd/conf.modules.d/*.load"

Using puppetlabs/apache how should I control which modules get loaded/omitted ?

My objective is to get the Apache httpd 2.4.18 running under Oracle Linux along with some SVN stuff that I will worry about later when I'm more familiar with what I'm doing.

Oracle Linux is the same as RHEL

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-04-03 04:49:48 -0500

You can disable loading of default modules when declaring the apache class with parameter default_mods => false.

You then have to specify all required modules using the apache::mod define.

edit flag offensive delete link more



Things begin to come clearer, thank you. So a script can do away with the default then include and configure modules individually. Listing all the required modules should be easy enough, configuring them I'm not so sure. Is there a way to retain the default but exclude modules individually ?

vw gravatar imagevw ( 2016-04-04 05:57:48 -0500 )edit

Reading about default_mods => false tells me: If false, it only includes the mods required to make HTTPD work This is great news, httpd works without me needing to configure the essential modules.

vw gravatar imagevw ( 2016-04-04 07:24:51 -0500 )edit

answered 2016-04-01 12:22:01 -0500

DarylW gravatar image

I'm not actually working with the module, but I can try to guide you in the right direction...

In the template for the httpd.conf file, your above Include directory is being produced by this line

Include "<%= @mod_load_dir %>/*.load"

If we look at how the README suggest that we add apache modules..

Installing Apache modules

There are two ways to install Apache modules using the Puppet apache module: •Use the apache::mod::<module name=""> classes to install specific Apache modules with parameters. •Use the apache::mod defined type to install arbitrary Apache modules.

Installing specific modules

The Puppet apache module supports installing many common Apache modules, often with parameterized configuration options. For a list of supported Apache modules, see the apache::mod::<module name=""> class references.

For example, you can install the mod_ssl Apache module with default settings by declaring the apache::mod::ssl class:

class { 'apache::mod::ssl': }

apache::mod::ssl has several parameterized options that you can set when declaring it. For instance, to enable modssl with compression enabled, set the sslcompression parameter to true:

class { 'apache::mod::ssl':
ssl_compression => true, }

Note that some modules have prerequisites, which are documented in their references under apache::mod::<module name=""> .

Installing arbitrary modules

You can pass the name of any module that your operating system's package manager can install to the apache::mod defined type to install it. Unlike the specific-module classes, the apache::mod defined type doesn't tailor the installation based on other installed modules or with specific parameters---Puppet only grabs and installs the module's package, leaving detailed configuration up to you.

For example, to install the modauthnzexternal Apache module, declare the defined type with the 'modauthnzexternal' name:

apache::mod { 'modauthnzexternal': }

There are several optional parameters you can specify when defining Apache modules this way. See the defined type's reference for details.

So.. it looks like to install a specific module by name, you use the form

apache::mod { 'mod_authnz_external': }

If this answers your question, Great! If you need more of a deep dive into what the module is doing, let me know!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-01 09:46:27 -0500

Seen: 288 times

Last updated: Apr 03 '16