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