1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
# @summary
# Installs `mod_peruser`.
#
# @param minspareprocessors
#
# @param minprocessors
# The minimum amount of processors
#
# @param maxprocessors
# The maximum amount of processors
#
# @param maxclients
# The maximum amount of clients
#
# @param maxrequestsperchild
# The maximum amount of requests per child
#
# @param idletimeout
#
# @param expiretimeout
#
# @param keepalive
#
class apache::mod::peruser (
Integer $minspareprocessors = 2,
Integer $minprocessors = 2,
Integer $maxprocessors = 10,
Integer $maxclients = 150,
Integer $maxrequestsperchild = 1000,
Integer $idletimeout = 120,
Integer $expiretimeout = 120,
Apache::OnOff $keepalive = 'Off',
) {
include apache
case $facts['os']['family'] {
'FreeBSD' : {
fail("Unsupported osfamily ${$facts['os']['family']}")
}
default: {
if $facts['os']['family'] == 'Gentoo' {
::portage::makeconf { 'apache2_mpms':
content => 'peruser',
}
}
if defined(Class['apache::mod::event']) {
fail('May not include both apache::mod::peruser and apache::mod::event on the same node')
}
if defined(Class['apache::mod::itk']) {
fail('May not include both apache::mod::peruser and apache::mod::itk on the same node')
}
if defined(Class['apache::mod::prefork']) {
fail('May not include both apache::mod::peruser and apache::mod::prefork on the same node')
}
if defined(Class['apache::mod::worker']) {
fail('May not include both apache::mod::peruser and apache::mod::worker on the same node')
}
File {
owner => 'root',
group => $apache::params::root_group,
mode => $apache::file_mode,
}
$mod_dir = $apache::mod_dir
# Template uses:
# - $minspareprocessors
# - $minprocessors
# - $maxprocessors
# - $maxclients
# - $maxrequestsperchild
# - $idletimeout
# - $expiretimeout
# - $keepalive
# - $mod_dir
$parameters = {
'minspareprocessors' => $minspareprocessors,
'minprocessors' => $minprocessors,
'maxprocessors' => $maxprocessors,
'maxclients' => $maxclients,
'maxrequestsperchild' => $maxrequestsperchild,
'idletimeout' => $idletimeout,
'expiretimeout' => $expiretimeout,
'keepalive' => $keepalive,
'mod_dir' => $mod_dir,
}
file { "${apache::mod_dir}/peruser.conf":
ensure => file,
mode => $apache::file_mode,
content => epp('apache/mod/peruser.conf.epp', $parameters),
require => Exec["mkdir ${apache::mod_dir}"],
before => File[$apache::mod_dir],
notify => Class['apache::service'],
}
file { "${apache::mod_dir}/peruser":
ensure => directory,
require => File[$apache::mod_dir],
}
file { "${apache::mod_dir}/peruser/multiplexers":
ensure => directory,
require => File["${apache::mod_dir}/peruser"],
}
file { "${apache::mod_dir}/peruser/processors":
ensure => directory,
require => File["${apache::mod_dir}/peruser"],
}
::apache::peruser::multiplexer { '01-default': }
}
}
}
|