Puppet Class: apache::mod::peruser

Defined in:
manifests/mod/peruser.pp

Summary

Installs `mod_peruser`.

Overview

Parameters:

  • minspareprocessors (Integer) (defaults to: 2)
  • minprocessors (Integer) (defaults to: 2)

    The minimum amount of processors

  • maxprocessors (Integer) (defaults to: 10)

    The maximum amount of processors

  • maxclients (Integer) (defaults to: 150)

    The maximum amount of clients

  • maxrequestsperchild (Integer) (defaults to: 1000)

    The maximum amount of requests per child

  • idletimeout (Integer) (defaults to: 120)
  • expiretimeout (Integer) (defaults to: 120)
  • keepalive (Enum['On', 'Off']) (defaults to: 'Off')


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
# File 'manifests/mod/peruser.pp', line 24

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,
  Enum['On', 'Off'] $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
      file { "${apache::mod_dir}/peruser.conf":
        ensure  => file,
        mode    => $apache::file_mode,
        content => template('apache/mod/peruser.conf.erb'),
        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': }
    }
  }
}