Defined Type: httpd::mod_conf

Defined in:
modules/httpd/manifests/mod_conf.pp

Overview

SPDX-License-Identifier: Apache-2.0

Define: httpd::mod_conf

Custom resource for managing the configuration of Apache modules.

Parameters

mod

Module name. Defaults to the resource title.

loadfile

The .load config file that Puppet should manage. Defaults to the resource title plus a '.load' suffix.

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • mod (String) (defaults to: $title)
  • loadfile (String) (defaults to: "${title}.load")


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'modules/httpd/manifests/mod_conf.pp', line 15

define httpd::mod_conf(
    Wmflib::Ensure $ensure   = present,
    String $mod      = $title,
    String $loadfile = "${title}.load",
)
{
    ensure_packages('apache2')

    if $ensure == present {
        exec { "ensure_${ensure}_mod_${mod}":
            command => "/usr/sbin/a2enmod ${mod}",
            creates => "/etc/apache2/mods-enabled/${loadfile}",
            notify  => Service['apache2'],
            require => Package['apache2'],
        }
    } else {
        exec { "ensure_${ensure}_mod_${mod}":
            command => "/usr/sbin/a2dismod -f ${mod}",
            onlyif  => "/usr/bin/test -L /etc/apache2/mods-enabled/${loadfile}",
            notify  => Service['apache2'],
            require => Package['apache2'],
        }
    }
}