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