/[adm]/puppet/modules/apache/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/apache/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2099 - (show annotations) (download)
Tue Dec 20 13:41:07 2011 UTC (9 years, 9 months ago) by boklm
File size: 9010 byte(s)
add class for mod_geoip
1 class apache {
2
3 class base {
4 $php_date_timezone = "UTC"
5
6 # number of time the log file are rotated before being removed
7 $httpdlogs_rotate = "24"
8
9 package { "apache-mpm-prefork":
10 alias => apache,
11 ensure => installed
12 }
13
14 package { "apache-conf":
15 ensure => installed,
16 }
17
18 service { httpd:
19 alias => apache,
20 ensure => running,
21 subscribe => [ Package['apache-mpm-prefork'] ],
22 }
23
24 file { "customization.conf":
25 ensure => present,
26 path => "/etc/httpd/conf.d/customization.conf",
27 content => template("apache/customization.conf"),
28 require => Package["apache-conf"],
29 notify => Service["apache"],
30 owner => root,
31 group => root,
32 mode => 644,
33 }
34
35 file { "00_default_vhosts.conf":
36 path => "/etc/httpd/conf/vhosts.d/00_default_vhosts.conf",
37 ensure => "present",
38 owner => root,
39 group => root,
40 mode => 644,
41 notify => Service['apache'],
42 require => Package["apache-conf"],
43 content => template("apache/00_default_vhosts.conf")
44 }
45
46 file { "/etc/logrotate.d/httpd":
47 ensure => "present",
48 owner => root,
49 group => root,
50 mode => 644,
51 content => template("apache/logrotate")
52 }
53
54 }
55
56 class mod_php inherits base {
57 package { "apache-mod_php":
58 ensure => installed
59 }
60
61 file { "/etc/httpd/conf.d/mod_php.conf":
62 ensure => present,
63 owner => root,
64 group => root,
65 mode => 644,
66 require => Package['apache-conf'],
67 content => template('apache/mod_php.conf'),
68 notify => Service['apache'],
69 }
70 }
71
72 class mod_perl inherits base {
73 package { "apache-mod_perl":
74 ensure => installed
75 }
76 }
77
78 class mod_fcgid inherits base {
79 package { "apache-mod_fcgid":
80 ensure => installed
81 }
82 }
83
84 class mod_fastcgi inherits base {
85 package { "apache-mod_fastcgi":
86 ensure => installed
87 }
88 }
89
90 class mod_ssl inherits base {
91 file { "/etc/ssl/apache/":
92 ensure => directory
93 }
94
95 package { "apache-mod_ssl":
96 ensure => installed
97 }
98
99 file { "01_default_ssl_vhost.conf":
100 path => '/etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf',
101 ensure => "present",
102 owner => root,
103 group => root,
104 mode => 644,
105 notify => Service['apache'],
106 require => Package["apache-conf"],
107 content => template("apache/01_default_ssl_vhost.conf")
108 }
109
110 file { "ssl.conf":
111 ensure => present,
112 path => "/etc/httpd/conf.d/ssl.conf",
113 content => template("apache/ssl.conf"),
114 require => Package["apache-conf"],
115 notify => Service["apache"],
116 owner => root,
117 group => root,
118 mode => 644,
119 }
120 }
121
122 class mod_wsgi inherits base {
123 package { "apache-mod_wsgi":
124 ensure => installed
125 }
126
127 file { "/usr/local/lib/wsgi":
128 ensure => directory,
129 owner => root,
130 group => root,
131 mode => 644,
132 }
133
134 file { "/etc/httpd/conf.d/mod_wsgi.conf":
135 ensure => present,
136 owner => root,
137 group => root,
138 mode => 644,
139 require => Package['apache-conf'],
140 content => template('apache/mod_wsgi.conf'),
141 notify => Service['apache'],
142 }
143
144 }
145
146 class mod_proxy inherits base {
147 package { "apache-mod_proxy":
148 ensure => installed
149 }
150 }
151
152 class mod_public_html inherits base {
153 package { "apache-mod_public_html":
154 ensure => installed
155 }
156 }
157
158 class mod_deflate inherits base {
159 package { "apache-mod_deflate":
160 ensure => installed
161 }
162 }
163
164 class mod_geoip inherits base {
165 package { "apache-mod_geoip":
166 ensure => installed
167 }
168 }
169
170 define vhost_base($content = '',
171 $location = '/dev/null',
172 $use_ssl = false,
173 $vhost = false,
174 $aliases = {},
175 $server_aliases = [],
176 $access_logfile = false,
177 $error_logfile = false,
178 $options = [],
179 $enable_public_html = false) {
180 include apache::base
181 $httpd_logdir = "/var/log/httpd"
182 if ! $vhost {
183 $real_vhost = $name
184 } else {
185 $real_vhost = $vhost
186 }
187
188 if ! $access_logfile {
189 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
190 } else {
191 $real_access_logfile = $access_logfile
192 }
193 if ! $error_logfile {
194 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
195 } else {
196 $real_error_logfile = $error_logfile
197 }
198
199 if $use_ssl {
200 include apache::mod_ssl
201 if $wildcard_sslcert != 'true' {
202 openssl::self_signed_cert{ "$real_vhost":
203 directory => "/etc/ssl/apache/",
204 before => File["$filename"],
205 }
206 }
207 }
208
209 if $enable_public_html {
210 include apache::mod_public_html
211 }
212
213 $filename = "$name.conf"
214 file { "$filename":
215 path => "/etc/httpd/conf/vhosts.d/$filename",
216 ensure => "present",
217 owner => root,
218 group => root,
219 mode => 644,
220 notify => Service['apache'],
221 require => Package['apache-conf'],
222 content => template("apache/vhost_base.conf")
223 }
224 }
225
226 define vhost_redirect_ssl() {
227 vhost_base { "redirect_ssl_$name":
228 vhost => $name,
229 content => template("apache/vhost_ssl_redirect.conf")
230 }
231 }
232
233 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
234
235 include apache::mod_fastcgi
236 vhost_base { $name:
237 vhost => $vhost,
238 use_ssl => $use_ssl,
239 content => template("apache/vhost_catalyst_app.conf")
240 }
241 }
242
243 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
244 include apache::mod_wsgi
245 vhost_base { $name:
246 use_ssl => $use_ssl,
247 content => template("apache/vhost_django_app.conf"),
248 aliases => $aliases,
249 }
250
251 # module is a ruby reserved keyword, cannot be used in templates
252 $django_module = $module
253 file { "$name.wsgi":
254 path => "/usr/local/lib/wsgi/$name.wsgi",
255 ensure => "present",
256 owner => root,
257 group => root,
258 mode => 755,
259 notify => Service['apache'],
260 content => template("apache/django.wsgi")
261 }
262 }
263
264 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
265 include apache::mod_wsgi
266 vhost_base { $name:
267 aliases => $aliases,
268 server_aliases => $server_aliases,
269 content => template("apache/vhost_wsgi.conf")
270 }
271 }
272
273 define vhost_other_app($vhost_file) {
274 include apache::base
275 file { "$name.conf":
276 path => "/etc/httpd/conf/vhosts.d/$name.conf",
277 ensure => "present",
278 owner => root,
279 group => root,
280 mode => 644,
281 notify => Service['apache'],
282 require => Package['apache-conf'],
283 content => template($vhost_file)
284 }
285 }
286
287 define vhost_simple($location) {
288 include apache::base
289 vhost_base { $name:
290 location => $location,
291 }
292 }
293
294 define vhost_redirect($url,
295 $vhost = false,
296 $use_ssl = false) {
297 include apache::base
298 vhost_base { $name:
299 use_ssl => $use_ssl,
300 vhost => $vhost,
301 content => template("apache/vhost_redirect.conf"),
302 }
303 }
304
305 define vhost_reverse_proxy($url,
306 $vhost = false,
307 $use_ssl = false) {
308 include apache::mod_proxy
309 vhost_base { $name:
310 use_ssl => $use_ssl,
311 vhost => $vhost,
312 content => template("apache/vhost_reverse_proxy.conf")
313 }
314 }
315
316 define webapp_other($webapp_file) {
317 include apache::base
318 $webappname = $name
319 file { "webapp_$name.conf":
320 path => "/etc/httpd/conf/webapps.d/$webappname.conf",
321 ensure => "present",
322 owner => root,
323 group => root,
324 mode => 644,
325 notify => Service['apache'],
326 require => Package['apache-conf'],
327 content => template($webapp_file)
328 }
329 }
330 }

  ViewVC Help
Powered by ViewVC 1.1.28