1 |
misc |
80 |
class apache { |
2 |
|
|
|
3 |
|
|
class base { |
4 |
boklm |
1500 |
|
5 |
boklm |
1636 |
# number of time the log file are rotated before being removed |
6 |
|
|
$httpdlogs_rotate = "24" |
7 |
|
|
|
8 |
boklm |
2104 |
$apache_user = 'apache' |
9 |
|
|
$apache_group = 'apache' |
10 |
|
|
|
11 |
misc |
80 |
package { "apache-mpm-prefork": |
12 |
misc |
117 |
alias => apache, |
13 |
misc |
80 |
ensure => installed |
14 |
|
|
} |
15 |
|
|
|
16 |
misc |
1065 |
package { "apache-conf": |
17 |
|
|
ensure => installed, |
18 |
|
|
} |
19 |
|
|
|
20 |
misc |
96 |
service { httpd: |
21 |
|
|
alias => apache, |
22 |
misc |
80 |
ensure => running, |
23 |
|
|
subscribe => [ Package['apache-mpm-prefork'] ], |
24 |
|
|
} |
25 |
misc |
117 |
|
26 |
|
|
file { "customization.conf": |
27 |
|
|
ensure => present, |
28 |
misc |
126 |
path => "/etc/httpd/conf.d/customization.conf", |
29 |
misc |
117 |
content => template("apache/customization.conf"), |
30 |
misc |
1065 |
require => Package["apache-conf"], |
31 |
misc |
117 |
notify => Service["apache"], |
32 |
|
|
owner => root, |
33 |
|
|
group => root, |
34 |
|
|
mode => 644, |
35 |
|
|
} |
36 |
boklm |
207 |
|
37 |
|
|
file { "00_default_vhosts.conf": |
38 |
|
|
path => "/etc/httpd/conf/vhosts.d/00_default_vhosts.conf", |
39 |
|
|
ensure => "present", |
40 |
|
|
owner => root, |
41 |
|
|
group => root, |
42 |
|
|
mode => 644, |
43 |
|
|
notify => Service['apache'], |
44 |
misc |
1065 |
require => Package["apache-conf"], |
45 |
boklm |
207 |
content => template("apache/00_default_vhosts.conf") |
46 |
|
|
} |
47 |
boklm |
1241 |
|
48 |
boklm |
1635 |
file { "/etc/logrotate.d/httpd": |
49 |
|
|
ensure => "present", |
50 |
|
|
owner => root, |
51 |
|
|
group => root, |
52 |
|
|
mode => 644, |
53 |
|
|
content => template("apache/logrotate") |
54 |
|
|
} |
55 |
|
|
|
56 |
misc |
80 |
} |
57 |
|
|
|
58 |
|
|
class mod_php inherits base { |
59 |
misc |
2124 |
$php_date_timezone = "UTC" |
60 |
misc |
80 |
package { "apache-mod_php": |
61 |
|
|
ensure => installed |
62 |
|
|
} |
63 |
misc |
1185 |
|
64 |
|
|
file { "/etc/httpd/conf.d/mod_php.conf": |
65 |
|
|
ensure => present, |
66 |
|
|
owner => root, |
67 |
|
|
group => root, |
68 |
|
|
mode => 644, |
69 |
|
|
require => Package['apache-conf'], |
70 |
misc |
1188 |
content => template('apache/mod_php.conf'), |
71 |
misc |
1186 |
notify => Service['apache'], |
72 |
misc |
1185 |
} |
73 |
misc |
80 |
} |
74 |
|
|
|
75 |
|
|
class mod_perl inherits base { |
76 |
|
|
package { "apache-mod_perl": |
77 |
|
|
ensure => installed |
78 |
|
|
} |
79 |
|
|
} |
80 |
|
|
|
81 |
misc |
84 |
class mod_fcgid inherits base { |
82 |
|
|
package { "apache-mod_fcgid": |
83 |
|
|
ensure => installed |
84 |
|
|
} |
85 |
|
|
} |
86 |
|
|
|
87 |
misc |
124 |
class mod_fastcgi inherits base { |
88 |
|
|
package { "apache-mod_fastcgi": |
89 |
|
|
ensure => installed |
90 |
|
|
} |
91 |
|
|
} |
92 |
misc |
84 |
|
93 |
misc |
192 |
class mod_ssl inherits base { |
94 |
misc |
487 |
file { "/etc/ssl/apache/": |
95 |
|
|
ensure => directory |
96 |
|
|
} |
97 |
|
|
|
98 |
misc |
192 |
package { "apache-mod_ssl": |
99 |
|
|
ensure => installed |
100 |
|
|
} |
101 |
boklm |
1245 |
|
102 |
|
|
file { "01_default_ssl_vhost.conf": |
103 |
|
|
path => '/etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf', |
104 |
|
|
ensure => "present", |
105 |
|
|
owner => root, |
106 |
|
|
group => root, |
107 |
|
|
mode => 644, |
108 |
|
|
notify => Service['apache'], |
109 |
|
|
require => Package["apache-conf"], |
110 |
|
|
content => template("apache/01_default_ssl_vhost.conf") |
111 |
|
|
} |
112 |
boklm |
2085 |
|
113 |
|
|
file { "ssl.conf": |
114 |
|
|
ensure => present, |
115 |
|
|
path => "/etc/httpd/conf.d/ssl.conf", |
116 |
|
|
content => template("apache/ssl.conf"), |
117 |
|
|
require => Package["apache-conf"], |
118 |
|
|
notify => Service["apache"], |
119 |
|
|
owner => root, |
120 |
|
|
group => root, |
121 |
|
|
mode => 644, |
122 |
|
|
} |
123 |
misc |
192 |
} |
124 |
|
|
|
125 |
misc |
80 |
class mod_wsgi inherits base { |
126 |
|
|
package { "apache-mod_wsgi": |
127 |
|
|
ensure => installed |
128 |
|
|
} |
129 |
misc |
182 |
|
130 |
misc |
201 |
file { "/usr/local/lib/wsgi": |
131 |
misc |
182 |
ensure => directory, |
132 |
|
|
owner => root, |
133 |
|
|
group => root, |
134 |
|
|
mode => 644, |
135 |
|
|
} |
136 |
misc |
908 |
|
137 |
|
|
file { "/etc/httpd/conf.d/mod_wsgi.conf": |
138 |
|
|
ensure => present, |
139 |
|
|
owner => root, |
140 |
|
|
group => root, |
141 |
|
|
mode => 644, |
142 |
misc |
1065 |
require => Package['apache-conf'], |
143 |
misc |
1188 |
content => template('apache/mod_wsgi.conf'), |
144 |
misc |
1186 |
notify => Service['apache'], |
145 |
misc |
908 |
} |
146 |
|
|
|
147 |
misc |
80 |
} |
148 |
misc |
778 |
|
149 |
|
|
class mod_proxy inherits base { |
150 |
|
|
package { "apache-mod_proxy": |
151 |
|
|
ensure => installed |
152 |
|
|
} |
153 |
|
|
} |
154 |
misc |
167 |
|
155 |
misc |
929 |
class mod_public_html inherits base { |
156 |
|
|
package { "apache-mod_public_html": |
157 |
|
|
ensure => installed |
158 |
|
|
} |
159 |
|
|
} |
160 |
|
|
|
161 |
dams |
1021 |
class mod_deflate inherits base { |
162 |
|
|
package { "apache-mod_deflate": |
163 |
|
|
ensure => installed |
164 |
|
|
} |
165 |
|
|
} |
166 |
|
|
|
167 |
boklm |
2099 |
class mod_geoip inherits base { |
168 |
|
|
package { "apache-mod_geoip": |
169 |
|
|
ensure => installed |
170 |
|
|
} |
171 |
|
|
} |
172 |
|
|
|
173 |
misc |
928 |
define vhost_base($content = '', |
174 |
|
|
$location = '/dev/null', |
175 |
|
|
$use_ssl = false, |
176 |
misc |
930 |
$vhost = false, |
177 |
misc |
932 |
$aliases = {}, |
178 |
misc |
935 |
$server_aliases = [], |
179 |
boklm |
1630 |
$access_logfile = false, |
180 |
|
|
$error_logfile = false, |
181 |
pterjan |
1599 |
$options = [], |
182 |
misc |
930 |
$enable_public_html = false) { |
183 |
boklm |
1464 |
include apache::base |
184 |
boklm |
1633 |
$httpd_logdir = "/var/log/httpd" |
185 |
misc |
928 |
if ! $vhost { |
186 |
|
|
$real_vhost = $name |
187 |
|
|
} else { |
188 |
|
|
$real_vhost = $vhost |
189 |
misc |
176 |
} |
190 |
misc |
167 |
|
191 |
boklm |
1630 |
if ! $access_logfile { |
192 |
misc |
2015 |
$real_access_logfile = "$httpd_logdir/${real_vhost}-access_log" |
193 |
boklm |
1632 |
} else { |
194 |
|
|
$real_access_logfile = $access_logfile |
195 |
boklm |
1630 |
} |
196 |
|
|
if ! $error_logfile { |
197 |
misc |
2015 |
$real_error_logfile = "$httpd_logdir/${real_vhost}-error_log" |
198 |
boklm |
1632 |
} else { |
199 |
|
|
$real_error_logfile = $error_logfile |
200 |
boklm |
1630 |
} |
201 |
|
|
|
202 |
misc |
489 |
if $use_ssl { |
203 |
|
|
include apache::mod_ssl |
204 |
boklm |
1248 |
if $wildcard_sslcert != 'true' { |
205 |
boklm |
1237 |
openssl::self_signed_cert{ "$real_vhost": |
206 |
|
|
directory => "/etc/ssl/apache/", |
207 |
|
|
before => File["$filename"], |
208 |
|
|
} |
209 |
|
|
} |
210 |
misc |
489 |
} |
211 |
|
|
|
212 |
misc |
930 |
if $enable_public_html { |
213 |
|
|
include apache::mod_public_html |
214 |
|
|
} |
215 |
|
|
|
216 |
misc |
928 |
$filename = "$name.conf" |
217 |
|
|
file { "$filename": |
218 |
|
|
path => "/etc/httpd/conf/vhosts.d/$filename", |
219 |
misc |
167 |
ensure => "present", |
220 |
|
|
owner => root, |
221 |
|
|
group => root, |
222 |
|
|
mode => 644, |
223 |
|
|
notify => Service['apache'], |
224 |
misc |
1065 |
require => Package['apache-conf'], |
225 |
misc |
928 |
content => template("apache/vhost_base.conf") |
226 |
|
|
} |
227 |
|
|
} |
228 |
|
|
|
229 |
|
|
define vhost_redirect_ssl() { |
230 |
|
|
vhost_base { "redirect_ssl_$name": |
231 |
|
|
vhost => $name, |
232 |
|
|
content => template("apache/vhost_ssl_redirect.conf") |
233 |
|
|
} |
234 |
|
|
} |
235 |
|
|
|
236 |
boklm |
1617 |
define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) { |
237 |
misc |
928 |
|
238 |
|
|
include apache::mod_fastcgi |
239 |
|
|
vhost_base { $name: |
240 |
boklm |
1617 |
vhost => $vhost, |
241 |
misc |
928 |
use_ssl => $use_ssl, |
242 |
misc |
167 |
content => template("apache/vhost_catalyst_app.conf") |
243 |
|
|
} |
244 |
|
|
} |
245 |
misc |
182 |
|
246 |
misc |
1193 |
define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) { |
247 |
misc |
182 |
include apache::mod_wsgi |
248 |
misc |
928 |
vhost_base { $name: |
249 |
misc |
934 |
use_ssl => $use_ssl, |
250 |
misc |
1193 |
content => template("apache/vhost_django_app.conf"), |
251 |
|
|
aliases => $aliases, |
252 |
misc |
621 |
} |
253 |
misc |
928 |
|
254 |
misc |
612 |
# module is a ruby reserved keyword, cannot be used in templates |
255 |
|
|
$django_module = $module |
256 |
misc |
182 |
file { "$name.wsgi": |
257 |
misc |
201 |
path => "/usr/local/lib/wsgi/$name.wsgi", |
258 |
misc |
182 |
ensure => "present", |
259 |
|
|
owner => root, |
260 |
|
|
group => root, |
261 |
|
|
mode => 755, |
262 |
|
|
notify => Service['apache'], |
263 |
|
|
content => template("apache/django.wsgi") |
264 |
|
|
} |
265 |
|
|
} |
266 |
boklm |
280 |
|
267 |
misc |
935 |
define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) { |
268 |
misc |
812 |
include apache::mod_wsgi |
269 |
misc |
933 |
vhost_base { $name: |
270 |
|
|
aliases => $aliases, |
271 |
misc |
935 |
server_aliases => $server_aliases, |
272 |
misc |
812 |
content => template("apache/vhost_wsgi.conf") |
273 |
|
|
} |
274 |
|
|
} |
275 |
|
|
|
276 |
boklm |
280 |
define vhost_other_app($vhost_file) { |
277 |
misc |
412 |
include apache::base |
278 |
boklm |
280 |
file { "$name.conf": |
279 |
|
|
path => "/etc/httpd/conf/vhosts.d/$name.conf", |
280 |
|
|
ensure => "present", |
281 |
|
|
owner => root, |
282 |
|
|
group => root, |
283 |
|
|
mode => 644, |
284 |
|
|
notify => Service['apache'], |
285 |
misc |
1065 |
require => Package['apache-conf'], |
286 |
boklm |
280 |
content => template($vhost_file) |
287 |
|
|
} |
288 |
|
|
} |
289 |
|
|
|
290 |
misc |
742 |
define vhost_simple($location) { |
291 |
|
|
include apache::base |
292 |
misc |
928 |
vhost_base { $name: |
293 |
|
|
location => $location, |
294 |
|
|
} |
295 |
misc |
742 |
} |
296 |
|
|
|
297 |
boklm |
1319 |
define vhost_redirect($url, |
298 |
|
|
$vhost = false, |
299 |
|
|
$use_ssl = false) { |
300 |
misc |
931 |
include apache::base |
301 |
|
|
vhost_base { $name: |
302 |
boklm |
1319 |
use_ssl => $use_ssl, |
303 |
|
|
vhost => $vhost, |
304 |
misc |
931 |
content => template("apache/vhost_redirect.conf"), |
305 |
|
|
} |
306 |
|
|
} |
307 |
|
|
|
308 |
misc |
1103 |
define vhost_reverse_proxy($url, |
309 |
|
|
$vhost = false, |
310 |
|
|
$use_ssl = false) { |
311 |
misc |
778 |
include apache::mod_proxy |
312 |
misc |
928 |
vhost_base { $name: |
313 |
misc |
1102 |
use_ssl => $use_ssl, |
314 |
misc |
1103 |
vhost => $vhost, |
315 |
misc |
778 |
content => template("apache/vhost_reverse_proxy.conf") |
316 |
misc |
928 |
} |
317 |
misc |
778 |
} |
318 |
|
|
|
319 |
boklm |
280 |
define webapp_other($webapp_file) { |
320 |
misc |
422 |
include apache::base |
321 |
boklm |
280 |
$webappname = $name |
322 |
|
|
file { "webapp_$name.conf": |
323 |
|
|
path => "/etc/httpd/conf/webapps.d/$webappname.conf", |
324 |
|
|
ensure => "present", |
325 |
|
|
owner => root, |
326 |
|
|
group => root, |
327 |
|
|
mode => 644, |
328 |
|
|
notify => Service['apache'], |
329 |
misc |
1065 |
require => Package['apache-conf'], |
330 |
boklm |
280 |
content => template($webapp_file) |
331 |
|
|
} |
332 |
|
|
} |
333 |
misc |
80 |
} |