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