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