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