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