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