dev/provisioning/modules/apache/manifests/package.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 class apache::package (
       
     2   $ensure     = 'present',
       
     3   $mpm_module = $::apache::params::mpm_module,
       
     4 ) inherits ::apache::params {
       
     5 
       
     6   # The base class must be included first because it is used by parameter defaults
       
     7   if ! defined(Class['apache']) {
       
     8     fail('You must include the apache base class before using any apache defined resources')
       
     9   }
       
    10 
       
    11   case $::osfamily {
       
    12     'FreeBSD': {
       
    13       case $mpm_module {
       
    14         'prefork': {
       
    15           $set = 'MPM_PREFORK'
       
    16           $unset = 'MPM_WORKER MPM_EVENT'
       
    17         }
       
    18         'worker': {
       
    19           $set = 'MPM_WORKER'
       
    20           $unset = 'MPM_PREFORK MPM_EVENT'
       
    21         }
       
    22         'event': {
       
    23           $set = 'MPM_EVENT'
       
    24           $unset = 'MPM_PREFORK MPM_WORKER'
       
    25         }
       
    26         'itk': {
       
    27           $set = undef
       
    28           $unset = undef
       
    29           package { 'www/mod_mpm_itk':
       
    30             ensure => installed,
       
    31           }
       
    32         }
       
    33         default: { fail("MPM module ${mpm_module} not supported on FreeBSD") }
       
    34       }
       
    35 
       
    36       # Configure ports to have apache build options set correctly
       
    37       if $set {
       
    38         file_line { 'apache SET options in /etc/make.conf':
       
    39           ensure => $ensure,
       
    40           path   => '/etc/make.conf',
       
    41           line   => "apache24_SET_FORCE=${set}",
       
    42           match  => '^apache24_SET_FORCE=.*',
       
    43           before => Package['httpd'],
       
    44         }
       
    45         file_line { 'apache UNSET options in /etc/make.conf':
       
    46           ensure => $ensure,
       
    47           path   => '/etc/make.conf',
       
    48           line   => "apache24_UNSET_FORCE=${unset}",
       
    49           match  => '^apache24_UNSET_FORCE=.*',
       
    50           before => Package['httpd'],
       
    51         }
       
    52       }
       
    53       $apache_package = $::apache::apache_name
       
    54     }
       
    55     default: {
       
    56       $apache_package = $::apache::apache_name
       
    57     }
       
    58   }
       
    59 
       
    60   package { 'httpd':
       
    61     ensure => $ensure,
       
    62     name   => $apache_package,
       
    63     notify => Class['Apache::Service'],
       
    64   }
       
    65 }