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