]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/manifests/mod/prefork.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / apache / manifests / mod / prefork.pp
1 class apache::mod::prefork (
2   $startservers        = '8',
3   $minspareservers     = '5',
4   $maxspareservers     = '20',
5   $serverlimit         = '256',
6   $maxclients          = '256',
7   $maxrequestsperchild = '4000',
8   $apache_version      = $::apache::apache_version,
9 ) {
10   if defined(Class['apache::mod::event']) {
11     fail('May not include both apache::mod::prefork and apache::mod::event on the same node')
12   }
13   if versioncmp($apache_version, '2.4') < 0 {
14     if defined(Class['apache::mod::itk']) {
15       fail('May not include both apache::mod::prefork and apache::mod::itk on the same node')
16     }
17   }
18   if defined(Class['apache::mod::peruser']) {
19     fail('May not include both apache::mod::prefork and apache::mod::peruser on the same node')
20   }
21   if defined(Class['apache::mod::worker']) {
22     fail('May not include both apache::mod::prefork and apache::mod::worker on the same node')
23   }
24   File {
25     owner => 'root',
26     group => $::apache::params::root_group,
27     mode  => '0644',
28   }
29
30   # Template uses:
31   # - $startservers
32   # - $minspareservers
33   # - $maxspareservers
34   # - $serverlimit
35   # - $maxclients
36   # - $maxrequestsperchild
37   file { "${::apache::mod_dir}/prefork.conf":
38     ensure  => file,
39     content => template('apache/mod/prefork.conf.erb'),
40     require => Exec["mkdir ${::apache::mod_dir}"],
41     before  => File[$::apache::mod_dir],
42     notify  => Class['apache::service'],
43   }
44
45   case $::osfamily {
46     'redhat': {
47       if versioncmp($apache_version, '2.4') >= 0 {
48         ::apache::mpm{ 'prefork':
49           apache_version => $apache_version,
50         }
51       }
52       else {
53         file_line { '/etc/sysconfig/httpd prefork enable':
54           ensure  => present,
55           path    => '/etc/sysconfig/httpd',
56           line    => '#HTTPD=/usr/sbin/httpd.worker',
57           match   => '#?HTTPD=/usr/sbin/httpd.worker',
58           require => Package['httpd'],
59           notify  => Class['apache::service'],
60         }
61       }
62     }
63     'debian', 'freebsd', 'Suse' : {
64       ::apache::mpm{ 'prefork':
65         apache_version => $apache_version,
66       }
67     }
68     'gentoo': {
69       ::portage::makeconf { 'apache2_mpms':
70         content => 'prefork',
71       }
72     }
73     default: {
74       fail("Unsupported osfamily ${::osfamily}")
75     }
76   }
77 }