dev/provisioning/modules/apache/manifests/mod/event.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 class apache::mod::event (
       
     2   $startservers           = '2',
       
     3   $maxclients             = '150',
       
     4   $minsparethreads        = '25',
       
     5   $maxsparethreads        = '75',
       
     6   $threadsperchild        = '25',
       
     7   $maxrequestsperchild    = '0',
       
     8   $serverlimit            = '25',
       
     9   $apache_version         = $::apache::apache_version,
       
    10   $threadlimit            = '64',
       
    11   $listenbacklog          = '511',
       
    12   $maxrequestworkers      = '250',
       
    13   $maxconnectionsperchild = '0',
       
    14 ) {
       
    15   if defined(Class['apache::mod::itk']) {
       
    16     fail('May not include both apache::mod::event and apache::mod::itk on the same node')
       
    17   }
       
    18   if defined(Class['apache::mod::peruser']) {
       
    19     fail('May not include both apache::mod::event and apache::mod::peruser on the same node')
       
    20   }
       
    21   if defined(Class['apache::mod::prefork']) {
       
    22     fail('May not include both apache::mod::event and apache::mod::prefork on the same node')
       
    23   }
       
    24   if defined(Class['apache::mod::worker']) {
       
    25     fail('May not include both apache::mod::event and apache::mod::worker on the same node')
       
    26   }
       
    27   File {
       
    28     owner => 'root',
       
    29     group => $::apache::params::root_group,
       
    30     mode  => '0644',
       
    31   }
       
    32 
       
    33   # Template uses:
       
    34   # - $startservers
       
    35   # - $maxclients
       
    36   # - $minsparethreads
       
    37   # - $maxsparethreads
       
    38   # - $threadsperchild
       
    39   # - $maxrequestsperchild
       
    40   # - $serverlimit
       
    41   file { "${::apache::mod_dir}/event.conf":
       
    42     ensure  => file,
       
    43     content => template('apache/mod/event.conf.erb'),
       
    44     require => Exec["mkdir ${::apache::mod_dir}"],
       
    45     before  => File[$::apache::mod_dir],
       
    46     notify  => Class['apache::service'],
       
    47   }
       
    48 
       
    49   case $::osfamily {
       
    50     'redhat': {
       
    51       if versioncmp($apache_version, '2.4') >= 0 {
       
    52         apache::mpm{ 'event':
       
    53           apache_version => $apache_version,
       
    54         }
       
    55       }
       
    56     }
       
    57     'debian','freebsd' : {
       
    58       apache::mpm{ 'event':
       
    59         apache_version => $apache_version,
       
    60       }
       
    61     }
       
    62     'gentoo': {
       
    63       ::portage::makeconf { 'apache2_mpms':
       
    64         content => 'event',
       
    65       }
       
    66     }
       
    67     default: {
       
    68       fail("Unsupported osfamily ${::osfamily}")
       
    69     }
       
    70   }
       
    71 }