view modules/apache/manifests/mpm.pp @ 121:6709f2052217 puppet-3.6

Add eBay to Postscreen whitelist
author IBBoard <dev@ibboard.co.uk>
date Fri, 02 Sep 2016 13:40:26 +0100
parents 37675581a273
children 675c1cc61eaf
line wrap: on
line source

define apache::mpm (
  $lib_path       = $::apache::params::lib_path,
  $apache_version = $::apache::apache_version,
) {
  if ! defined(Class['apache']) {
    fail('You must include the apache base class before using any apache defined resources')
  }

  $mpm     = $name
  $mod_dir = $::apache::mod_dir

  $_lib  = "mod_mpm_${mpm}.so"
  $_path = "${lib_path}/${_lib}"
  $_id   = "mpm_${mpm}_module"

  if versioncmp($apache_version, '2.4') >= 0 and
    (($::osfamily != 'FreeBSD') or
    ($::osfamily == 'FreeBSD' and $mpm == 'itk')) {

    file { "${mod_dir}/${mpm}.load":
      ensure  => file,
      path    => "${mod_dir}/${mpm}.load",
      content => "LoadModule ${_id} ${_path}\n",
      require => [
        Package['httpd'],
        Exec["mkdir ${mod_dir}"],
      ],
      before  => File[$mod_dir],
      notify  => Class['apache::service'],
    }
  }

  case $::osfamily {
    'debian': {
      file { "${::apache::mod_enable_dir}/${mpm}.conf":
        ensure  => link,
        target  => "${::apache::mod_dir}/${mpm}.conf",
        require => Exec["mkdir ${::apache::mod_enable_dir}"],
        before  => File[$::apache::mod_enable_dir],
        notify  => Class['apache::service'],
      }

      if versioncmp($apache_version, '2.4') >= 0 {
        file { "${::apache::mod_enable_dir}/${mpm}.load":
          ensure  => link,
          target  => "${::apache::mod_dir}/${mpm}.load",
          require => Exec["mkdir ${::apache::mod_enable_dir}"],
          before  => File[$::apache::mod_enable_dir],
          notify  => Class['apache::service'],
        }

        if $mpm == 'itk' {
            file { "${lib_path}/mod_mpm_itk.so":
              ensure => link,
              target => "${lib_path}/mpm_itk.so"
            }
        }
      }

      if versioncmp($apache_version, '2.4') < 0 {
        package { "apache2-mpm-${mpm}":
          ensure => present,
        }
      }
    }
    'freebsd': {
      class { '::apache::package':
        mpm_module => $mpm
      }
    }
    'redhat': {
      # so we don't fail
    }
    default: {
      fail("Unsupported osfamily ${::osfamily}")
    }
  }
}