Puppet Class: simp_apache::conf

Defined in:
manifests/conf.pp

Overview

This class sets up apache.conf.

Parameters:

  • httpd_timeout (Integer) (defaults to: 120)

    The Timeout variable. Renamed to not conflict with the Puppet reserved word ‘timeout’.

  • httpd_loglevel (Simp_apache::LogSeverity) (defaults to: 'warn')

    The LogLevel variable. Renamed to not conflict with the Puppet reserved word ‘loglevel’.

  • listen (Array[Variant[Simplib::Host::Port, Simplib::Port]]) (defaults to: [80])

    An array of ports upon which Apache should listen.

    NOTE: If you are using an IPv6 with a port, you need to

    bracket the address
    
  • firewall (Boolean) (defaults to: simplib::lookup('simp_options::firewall', { 'default_value' => false }))

    Whether or not to use the SIMP IPTables module.

  • syslog (Boolean) (defaults to: simplib::lookup('simp_options::syslog', { 'default_value' => false }))

    Whether or not to use the SIMP Rsyslog module.

  • syslog_target (Stdlib::AbsolutePath) (defaults to: '/var/log/httpd')

    If $syslog is true, store the apache logs at this location.

  • purge (Boolean) (defaults to: true)

    Whether or not to purge the configuration directories.

  • keepalive (Boolean) (defaults to: false)
  • maxkeepalive (Integer) (defaults to: 100)
  • keepalivetimeout (Integer) (defaults to: 15)
  • prefork_startservers (Integer) (defaults to: 8)
  • prefork_minspareservers (Integer) (defaults to: 5)
  • prefork_maxspareservers (Integer) (defaults to: 20)
  • prefork_serverlimit (Integer) (defaults to: 3000)
  • prefork_maxclients (Integer) (defaults to: 3000)
  • prefork_maxrequestsperchild (Integer) (defaults to: 4000)
  • worker_startservers (Integer) (defaults to: 2)
  • worker_maxclients (Integer) (defaults to: 3000)
  • worker_minsparethreads (Integer) (defaults to: 25)
  • worker_maxsparethreads (Integer) (defaults to: 75)
  • worker_threadsperchild (Integer) (defaults to: 25)
  • worker_maxrequestsperchild (Integer) (defaults to: 0)
  • includes (Optional[Array[String]]) (defaults to: undef)
  • serveradmin (String) (defaults to: 'root@localhost')
  • servername (Optional[String]) (defaults to: undef)
  • allowroot (Simplib::Netlist) (defaults to: ['127.0.0.1','::1'])
  • defaulttype (String) (defaults to: 'text/plain')
  • enablemmap (Boolean) (defaults to: true)
  • enablesendfile (Boolean) (defaults to: true)
  • user (String) (defaults to: 'apache')
  • group (String) (defaults to: 'apache')
  • logformat (String) (defaults to: '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"')
  • logfacility (Simplib::Syslog::LowerFacility) (defaults to: 'local6')

See Also:

  • following parameters are referenced in the stock apache documentation

Author:



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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'manifests/conf.pp', line 62

class simp_apache::conf (
  Integer                                            $httpd_timeout               = 120,
  Boolean                                            $keepalive                   = false,
  Integer                                            $maxkeepalive                = 100,
  Integer                                            $keepalivetimeout            = 15,
  Integer                                            $prefork_startservers        = 8,
  Integer                                            $prefork_minspareservers     = 5,
  Integer                                            $prefork_maxspareservers     = 20,
  Integer                                            $prefork_serverlimit         = 3000,
  Integer                                            $prefork_maxclients          = 3000,
  Integer                                            $prefork_maxrequestsperchild = 4000,
  Integer                                            $worker_startservers         = 2,
  Integer                                            $worker_maxclients           = 3000,
  Integer                                            $worker_minsparethreads      = 25,
  Integer                                            $worker_maxsparethreads      = 75,
  Integer                                            $worker_threadsperchild      = 25,
  Integer                                            $worker_maxrequestsperchild  = 0,
  Array[Variant[Simplib::Host::Port, Simplib::Port]] $listen                      = [80],
  Optional[Array[String]]                            $includes                    = undef,
  String                                             $serveradmin                 = 'root@localhost',
  Optional[String]                                   $servername                  = undef,
  Simplib::Netlist                                   $allowroot                   = ['127.0.0.1','::1'],
  String                                             $defaulttype                 = 'text/plain',
  Boolean                                            $enablemmap                  = true,
  Boolean                                            $enablesendfile              = true,
  String                                             $user                        = 'apache',
  String                                             $group                       = 'apache',
  Simp_apache::LogSeverity                           $httpd_loglevel              = 'warn',
  String                                             $logformat                   = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"',
  Simplib::Syslog::LowerFacility                     $logfacility                 = 'local6',
  Boolean                                            $firewall                    = simplib::lookup('simp_options::firewall', { 'default_value' => false }),
  Boolean                                            $syslog                      = simplib::lookup('simp_options::syslog', { 'default_value' => false }),
  Stdlib::AbsolutePath                               $syslog_target               = '/var/log/httpd',
  Boolean                                            $purge                       = true
) {
  include 'simp_apache'

  # Make sure the networks are all formatted correctly for Apache.
  $l_allowroot = simp_apache::munge_httpd_networks($allowroot)

  file { [
    '/etc/httpd/conf',
    '/etc/httpd/conf.d'
  ]:
    ensure   => 'directory',
    owner    => 'root',
    group    => $group,
    mode     => '0640',
    recurse  => true,
    purge    => $purge,
    force    => $purge,
    checksum => undef
  }

  file { '/etc/httpd/conf/httpd.conf':
    ensure  => 'file',
    owner   => 'root',
    group   => $group,
    mode    => '0640',
    content => template("${module_name}/etc/httpd/conf/httpd.conf.erb")
  }

  $_modules_target = $facts['os']['hardware'] ? {
    'x86_64' => '/usr/lib64/httpd/modules',
    default  => '/usr/lib/httpd/modules'
  }

  file { $simp_apache::data_dir:
    ensure => 'directory',
    owner  => 'root',
    group  => 'apache',
    mode   => '0640'
  }

  file { '/etc/httpd/conf/magic':
    ensure  => 'file',
    owner   => 'root',
    group   => 'apache',
    mode    => '0640',
    replace => false,
    content => epp("${module_name}/etc/httpd/conf/magic.epp")
  }

  file { '/etc/httpd/conf.d/welcome.conf': ensure => 'absent' }

  file { '/etc/mime.types':
    owner => 'root',
    group => 'root',
    mode  => '0644'
  }

  file { '/etc/httpd/logs':
    ensure => 'symlink',
    target => '/var/log/httpd',
    force  => true
  }

  file { '/etc/httpd/modules':
    ensure => 'symlink',
    target =>  $_modules_target,
    force  => true
  }

  file { '/etc/httpd/run':
    ensure => 'symlink',
    target => '/var/run/httpd',
    force  => true
  }

  file { '/var/log/httpd':
    ensure => 'directory',
    owner  => 'root',
    group  => 'root',
    mode   => '0700'
  }

  file { 'httpd_modules':
    ensure => 'directory',
    path   => $_modules_target,
    owner  => 'root',
    group  => 'root',
    mode   => '0755'
  }

  if $firewall {
    include 'iptables'

    iptables::listen::tcp_stateful { 'allow_http':
      order        => 11,
      trusted_nets => $l_allowroot,
      dports       => $listen
    }
  }

  if $syslog  {
    include '::rsyslog'
    rsyslog::rule::local { 'XX_apache_error':
      rule            => '$programname == \'httpd\' and $syslogseverity-text == \'err\'',
      target_log_file => "${syslog_target}/error_log",
      stop_processing => true
    }
    rsyslog::rule::local { 'YY_apache_access':
      rule            => '$programname == \'httpd\'',
      target_log_file => "${syslog_target}/access_log",
      stop_processing => true
    }
  }
}