dev/provisioning/modules/apache/manifests/mpm.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 define apache::mpm (
       
     2   $lib_path       = $::apache::lib_path,
       
     3   $apache_version = $::apache::apache_version,
       
     4 ) {
       
     5   if ! defined(Class['apache']) {
       
     6     fail('You must include the apache base class before using any apache defined resources')
       
     7   }
       
     8 
       
     9   $mpm     = $name
       
    10   $mod_dir = $::apache::mod_dir
       
    11 
       
    12   $_lib  = "mod_mpm_${mpm}.so"
       
    13   $_path = "${lib_path}/${_lib}"
       
    14   $_id   = "mpm_${mpm}_module"
       
    15 
       
    16   if versioncmp($apache_version, '2.4') >= 0 {
       
    17     file { "${mod_dir}/${mpm}.load":
       
    18       ensure  => file,
       
    19       path    => "${mod_dir}/${mpm}.load",
       
    20       content => "LoadModule ${_id} ${_path}\n",
       
    21       require => [
       
    22         Package['httpd'],
       
    23         Exec["mkdir ${mod_dir}"],
       
    24       ],
       
    25       before  => File[$mod_dir],
       
    26       notify  => Class['apache::service'],
       
    27     }
       
    28   }
       
    29 
       
    30   case $::osfamily {
       
    31     'debian': {
       
    32       file { "${::apache::mod_enable_dir}/${mpm}.conf":
       
    33         ensure  => link,
       
    34         target  => "${::apache::mod_dir}/${mpm}.conf",
       
    35         require => Exec["mkdir ${::apache::mod_enable_dir}"],
       
    36         before  => File[$::apache::mod_enable_dir],
       
    37         notify  => Class['apache::service'],
       
    38       }
       
    39 
       
    40       if versioncmp($apache_version, '2.4') >= 0 {
       
    41         file { "${::apache::mod_enable_dir}/${mpm}.load":
       
    42           ensure  => link,
       
    43           target  => "${::apache::mod_dir}/${mpm}.load",
       
    44           require => Exec["mkdir ${::apache::mod_enable_dir}"],
       
    45           before  => File[$::apache::mod_enable_dir],
       
    46           notify  => Class['apache::service'],
       
    47         }
       
    48 
       
    49         if $mpm == 'itk' {
       
    50             file { "${lib_path}/mod_mpm_itk.so":
       
    51               ensure => link,
       
    52               target => "${lib_path}/mpm_itk.so"
       
    53             }
       
    54         }
       
    55       }
       
    56 
       
    57       if versioncmp($apache_version, '2.4') < 0 {
       
    58         package { "apache2-mpm-${mpm}":
       
    59           ensure => present,
       
    60         }
       
    61       }
       
    62     }
       
    63     'freebsd': {
       
    64       class { '::apache::package':
       
    65         mpm_module => $mpm
       
    66       }
       
    67     }
       
    68     'redhat': {
       
    69       # so we don't fail
       
    70     }
       
    71     'Suse': {
       
    72       file { "${::apache::mod_enable_dir}/${mpm}.conf":
       
    73         ensure  => link,
       
    74         target  => "${::apache::mod_dir}/${mpm}.conf",
       
    75         require => Exec["mkdir ${::apache::mod_enable_dir}"],
       
    76         before  => File[$::apache::mod_enable_dir],
       
    77         notify  => Class['apache::service'],
       
    78       }
       
    79 
       
    80       if versioncmp($apache_version, '2.4') >= 0 {
       
    81         file { "${::apache::mod_enable_dir}/${mpm}.load":
       
    82           ensure  => link,
       
    83           target  => "${::apache::mod_dir}/${mpm}.load",
       
    84           require => Exec["mkdir ${::apache::mod_enable_dir}"],
       
    85           before  => File[$::apache::mod_enable_dir],
       
    86           notify  => Class['apache::service'],
       
    87         }
       
    88 
       
    89         if $mpm == 'itk' {
       
    90             file { "${lib_path}/mod_mpm_itk.so":
       
    91               ensure => link,
       
    92               target => "${lib_path}/mpm_itk.so"
       
    93             }
       
    94         }
       
    95       }
       
    96 
       
    97       if versioncmp($apache_version, '2.4') < 0 {
       
    98         package { "apache2-${mpm}":
       
    99           ensure => present,
       
   100         }
       
   101       }
       
   102     }
       
   103     default: {
       
   104       fail("Unsupported osfamily ${::osfamily}")
       
   105     }
       
   106   }
       
   107 }