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