comparison modules/apache/manifests/mod/prefork.pp @ 437:b8d6ada284dd

Update Apache module to latest version Also converted some params to ints to match
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2022 11:30:13 +0100
parents d9352a684e62
children adf6fe9bbc17
comparison
equal deleted inserted replaced
436:6293839019d0 437:b8d6ada284dd
32 # Maximum length of the queue of pending connections. 32 # Maximum length of the queue of pending connections.
33 # 33 #
34 # @see https://httpd.apache.org/docs/current/mod/prefork.html for additional documentation. 34 # @see https://httpd.apache.org/docs/current/mod/prefork.html for additional documentation.
35 # 35 #
36 class apache::mod::prefork ( 36 class apache::mod::prefork (
37 $startservers = '8', 37 Integer $startservers = 8,
38 $minspareservers = '5', 38 Integer $minspareservers = 5,
39 $maxspareservers = '20', 39 Integer $maxspareservers = 20,
40 $serverlimit = '256', 40 Integer $serverlimit = 256,
41 $maxclients = '256', 41 Integer $maxclients = 256,
42 $maxrequestworkers = undef, 42 Optional[Integer] $maxrequestworkers = undef,
43 $maxrequestsperchild = '4000', 43 Integer $maxrequestsperchild = 4000,
44 $maxconnectionsperchild = undef, 44 Optional[Integer] $maxconnectionsperchild = undef,
45 $apache_version = undef, 45 Optional[String] $apache_version = undef,
46 $listenbacklog = '511' 46 Integer $listenbacklog = 511
47 ) { 47 ) {
48 include ::apache 48 include apache
49 $_apache_version = pick($apache_version, $apache::apache_version) 49 $_apache_version = pick($apache_version, $apache::apache_version)
50 if defined(Class['apache::mod::event']) { 50 if defined(Class['apache::mod::event']) {
51 fail('May not include both apache::mod::prefork and apache::mod::event on the same node') 51 fail('May not include both apache::mod::prefork and apache::mod::event on the same node')
52 } 52 }
53 if versioncmp($_apache_version, '2.4') < 0 { 53 if versioncmp($_apache_version, '2.4') < 0 {
70 } 70 }
71 } 71 }
72 72
73 File { 73 File {
74 owner => 'root', 74 owner => 'root',
75 group => $::apache::params::root_group, 75 group => $apache::params::root_group,
76 mode => $::apache::file_mode, 76 mode => $apache::file_mode,
77 } 77 }
78 78
79 # Template uses: 79 # Template uses:
80 # - $startservers 80 # - $startservers
81 # - $minspareservers 81 # - $minspareservers
83 # - $serverlimit 83 # - $serverlimit
84 # - $maxclients 84 # - $maxclients
85 # - $maxrequestworkers 85 # - $maxrequestworkers
86 # - $maxrequestsperchild 86 # - $maxrequestsperchild
87 # - $maxconnectionsperchild 87 # - $maxconnectionsperchild
88 file { "${::apache::mod_dir}/prefork.conf": 88 file { "${apache::mod_dir}/prefork.conf":
89 ensure => file, 89 ensure => file,
90 content => template('apache/mod/prefork.conf.erb'), 90 content => template('apache/mod/prefork.conf.erb'),
91 require => Exec["mkdir ${::apache::mod_dir}"], 91 require => Exec["mkdir ${apache::mod_dir}"],
92 before => File[$::apache::mod_dir], 92 before => File[$apache::mod_dir],
93 notify => Class['apache::service'], 93 notify => Class['apache::service'],
94 } 94 }
95 95
96 case $::osfamily { 96 case $facts['os']['family'] {
97 'redhat': { 97 'redhat': {
98 if versioncmp($_apache_version, '2.4') >= 0 { 98 if versioncmp($_apache_version, '2.4') >= 0 {
99 ::apache::mpm{ 'prefork': 99 ::apache::mpm { 'prefork':
100 apache_version => $_apache_version, 100 apache_version => $_apache_version,
101 } 101 }
102 } 102 }
103 else { 103 else {
104 file_line { '/etc/sysconfig/httpd prefork enable': 104 file_line { '/etc/sysconfig/httpd prefork enable':
110 notify => Class['apache::service'], 110 notify => Class['apache::service'],
111 } 111 }
112 } 112 }
113 } 113 }
114 'debian', 'freebsd': { 114 'debian', 'freebsd': {
115 ::apache::mpm{ 'prefork': 115 ::apache::mpm { 'prefork':
116 apache_version => $_apache_version, 116 apache_version => $_apache_version,
117 } 117 }
118 } 118 }
119 'Suse': { 119 'Suse': {
120 ::apache::mpm{ 'prefork': 120 ::apache::mpm { 'prefork':
121 apache_version => $apache_version, 121 apache_version => $apache_version,
122 lib_path => '/usr/lib64/apache2-prefork', 122 lib_path => '/usr/lib64/apache2-prefork',
123 } 123 }
124 } 124 }
125 'gentoo': { 125 'gentoo': {
126 ::portage::makeconf { 'apache2_mpms': 126 ::portage::makeconf { 'apache2_mpms':
127 content => 'prefork', 127 content => 'prefork',
128 } 128 }
129 } 129 }
130 default: { 130 default: {
131 fail("Unsupported osfamily ${::osfamily}") 131 fail("Unsupported osfamily ${$facts['os']['family']}")
132 } 132 }
133 } 133 }
134 } 134 }