]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/manifests/mod/worker.pp
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / manifests / mod / worker.pp
1 class apache::mod::worker (
2   $startservers        = '2',
3   $maxclients          = '150',
4   $minsparethreads     = '25',
5   $maxsparethreads     = '75',
6   $threadsperchild     = '25',
7   $maxrequestsperchild = '0',
8   $serverlimit         = '25',
9   $threadlimit         = '64',
10   $apache_version      = $::apache::apache_version,
11 ) {
12   if defined(Class['apache::mod::event']) {
13     fail('May not include both apache::mod::worker and apache::mod::event on the same node')
14   }
15   if defined(Class['apache::mod::itk']) {
16     fail('May not include both apache::mod::worker and apache::mod::itk on the same node')
17   }
18   if defined(Class['apache::mod::peruser']) {
19     fail('May not include both apache::mod::worker and apache::mod::peruser on the same node')
20   }
21   if defined(Class['apache::mod::prefork']) {
22     fail('May not include both apache::mod::worker and apache::mod::prefork 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   # - $maxclients
33   # - $minsparethreads
34   # - $maxsparethreads
35   # - $threadsperchild
36   # - $maxrequestsperchild
37   # - $serverlimit
38   # - $threadLimit
39   file { "${::apache::mod_dir}/worker.conf":
40     ensure  => file,
41     content => template('apache/mod/worker.conf.erb'),
42     require => Exec["mkdir ${::apache::mod_dir}"],
43     before  => File[$::apache::mod_dir],
44     notify  => Class['apache::service'],
45   }
46
47   case $::osfamily {
48     'redhat': {
49       if versioncmp($apache_version, '2.4') >= 0 {
50         ::apache::mpm{ 'worker':
51           apache_version => $apache_version,
52         }
53       }
54       else {
55         file_line { '/etc/sysconfig/httpd worker enable':
56           ensure  => present,
57           path    => '/etc/sysconfig/httpd',
58           line    => 'HTTPD=/usr/sbin/httpd.worker',
59           match   => '#?HTTPD=/usr/sbin/httpd.worker',
60           require => Package['httpd'],
61           notify  => Class['apache::service'],
62         }
63       }
64     }
65     'debian', 'freebsd', 'Suse': {
66       ::apache::mpm{ 'worker':
67         apache_version => $apache_version,
68       }
69     }
70     'gentoo': {
71       ::portage::makeconf { 'apache2_mpms':
72         content => 'worker',
73       }
74     }
75     default: {
76       fail("Unsupported osfamily ${::osfamily}")
77     }
78   }
79 }