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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2099 - (hide annotations) (download)
Tue Dec 20 13:41:07 2011 UTC (12 years, 4 months ago) by boklm
File size: 9010 byte(s)
add class for mod_geoip
1 misc 80 class apache {
2    
3     class base {
4 boklm 1501 $php_date_timezone = "UTC"
5 boklm 1500
6 boklm 1636 # number of time the log file are rotated before being removed
7     $httpdlogs_rotate = "24"
8    
9 misc 80 package { "apache-mpm-prefork":
10 misc 117 alias => apache,
11 misc 80 ensure => installed
12     }
13    
14 misc 1065 package { "apache-conf":
15     ensure => installed,
16     }
17    
18 misc 96 service { httpd:
19     alias => apache,
20 misc 80 ensure => running,
21     subscribe => [ Package['apache-mpm-prefork'] ],
22     }
23 misc 117
24     file { "customization.conf":
25     ensure => present,
26 misc 126 path => "/etc/httpd/conf.d/customization.conf",
27 misc 117 content => template("apache/customization.conf"),
28 misc 1065 require => Package["apache-conf"],
29 misc 117 notify => Service["apache"],
30     owner => root,
31     group => root,
32     mode => 644,
33     }
34 boklm 207
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 misc 1065 require => Package["apache-conf"],
43 boklm 207 content => template("apache/00_default_vhosts.conf")
44     }
45 boklm 1241
46 boklm 1635 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 misc 80 }
55    
56     class mod_php inherits base {
57     package { "apache-mod_php":
58     ensure => installed
59     }
60 misc 1185
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 misc 1188 content => template('apache/mod_php.conf'),
68 misc 1186 notify => Service['apache'],
69 misc 1185 }
70 misc 80 }
71    
72     class mod_perl inherits base {
73     package { "apache-mod_perl":
74     ensure => installed
75     }
76     }
77    
78 misc 84 class mod_fcgid inherits base {
79     package { "apache-mod_fcgid":
80     ensure => installed
81     }
82     }
83    
84 misc 124 class mod_fastcgi inherits base {
85     package { "apache-mod_fastcgi":
86     ensure => installed
87     }
88     }
89 misc 84
90 misc 192 class mod_ssl inherits base {
91 misc 487 file { "/etc/ssl/apache/":
92     ensure => directory
93     }
94    
95 misc 192 package { "apache-mod_ssl":
96     ensure => installed
97     }
98 boklm 1245
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 boklm 2085
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 misc 192 }
121    
122 misc 80 class mod_wsgi inherits base {
123     package { "apache-mod_wsgi":
124     ensure => installed
125     }
126 misc 182
127 misc 201 file { "/usr/local/lib/wsgi":
128 misc 182 ensure => directory,
129     owner => root,
130     group => root,
131     mode => 644,
132     }
133 misc 908
134     file { "/etc/httpd/conf.d/mod_wsgi.conf":
135     ensure => present,
136     owner => root,
137     group => root,
138     mode => 644,
139 misc 1065 require => Package['apache-conf'],
140 misc 1188 content => template('apache/mod_wsgi.conf'),
141 misc 1186 notify => Service['apache'],
142 misc 908 }
143    
144 misc 80 }
145 misc 778
146     class mod_proxy inherits base {
147     package { "apache-mod_proxy":
148     ensure => installed
149     }
150     }
151 misc 167
152 misc 929 class mod_public_html inherits base {
153     package { "apache-mod_public_html":
154     ensure => installed
155     }
156     }
157    
158 dams 1021 class mod_deflate inherits base {
159     package { "apache-mod_deflate":
160     ensure => installed
161     }
162     }
163    
164 boklm 2099 class mod_geoip inherits base {
165     package { "apache-mod_geoip":
166     ensure => installed
167     }
168     }
169    
170 misc 928 define vhost_base($content = '',
171     $location = '/dev/null',
172     $use_ssl = false,
173 misc 930 $vhost = false,
174 misc 932 $aliases = {},
175 misc 935 $server_aliases = [],
176 boklm 1630 $access_logfile = false,
177     $error_logfile = false,
178 pterjan 1599 $options = [],
179 misc 930 $enable_public_html = false) {
180 boklm 1464 include apache::base
181 boklm 1633 $httpd_logdir = "/var/log/httpd"
182 misc 928 if ! $vhost {
183     $real_vhost = $name
184     } else {
185     $real_vhost = $vhost
186 misc 176 }
187 misc 167
188 boklm 1630 if ! $access_logfile {
189 misc 2015 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
190 boklm 1632 } else {
191     $real_access_logfile = $access_logfile
192 boklm 1630 }
193     if ! $error_logfile {
194 misc 2015 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
195 boklm 1632 } else {
196     $real_error_logfile = $error_logfile
197 boklm 1630 }
198    
199 misc 489 if $use_ssl {
200     include apache::mod_ssl
201 boklm 1248 if $wildcard_sslcert != 'true' {
202 boklm 1237 openssl::self_signed_cert{ "$real_vhost":
203     directory => "/etc/ssl/apache/",
204     before => File["$filename"],
205     }
206     }
207 misc 489 }
208    
209 misc 930 if $enable_public_html {
210     include apache::mod_public_html
211     }
212    
213 misc 928 $filename = "$name.conf"
214     file { "$filename":
215     path => "/etc/httpd/conf/vhosts.d/$filename",
216 misc 167 ensure => "present",
217     owner => root,
218     group => root,
219     mode => 644,
220     notify => Service['apache'],
221 misc 1065 require => Package['apache-conf'],
222 misc 928 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 boklm 1617 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
234 misc 928
235     include apache::mod_fastcgi
236     vhost_base { $name:
237 boklm 1617 vhost => $vhost,
238 misc 928 use_ssl => $use_ssl,
239 misc 167 content => template("apache/vhost_catalyst_app.conf")
240     }
241     }
242 misc 182
243 misc 1193 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
244 misc 182 include apache::mod_wsgi
245 misc 928 vhost_base { $name:
246 misc 934 use_ssl => $use_ssl,
247 misc 1193 content => template("apache/vhost_django_app.conf"),
248     aliases => $aliases,
249 misc 621 }
250 misc 928
251 misc 612 # module is a ruby reserved keyword, cannot be used in templates
252     $django_module = $module
253 misc 182 file { "$name.wsgi":
254 misc 201 path => "/usr/local/lib/wsgi/$name.wsgi",
255 misc 182 ensure => "present",
256     owner => root,
257     group => root,
258     mode => 755,
259     notify => Service['apache'],
260     content => template("apache/django.wsgi")
261     }
262     }
263 boklm 280
264 misc 935 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
265 misc 812 include apache::mod_wsgi
266 misc 933 vhost_base { $name:
267     aliases => $aliases,
268 misc 935 server_aliases => $server_aliases,
269 misc 812 content => template("apache/vhost_wsgi.conf")
270     }
271     }
272    
273 boklm 280 define vhost_other_app($vhost_file) {
274 misc 412 include apache::base
275 boklm 280 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 misc 1065 require => Package['apache-conf'],
283 boklm 280 content => template($vhost_file)
284     }
285     }
286    
287 misc 742 define vhost_simple($location) {
288     include apache::base
289 misc 928 vhost_base { $name:
290     location => $location,
291     }
292 misc 742 }
293    
294 boklm 1319 define vhost_redirect($url,
295     $vhost = false,
296     $use_ssl = false) {
297 misc 931 include apache::base
298     vhost_base { $name:
299 boklm 1319 use_ssl => $use_ssl,
300     vhost => $vhost,
301 misc 931 content => template("apache/vhost_redirect.conf"),
302     }
303     }
304    
305 misc 1103 define vhost_reverse_proxy($url,
306     $vhost = false,
307     $use_ssl = false) {
308 misc 778 include apache::mod_proxy
309 misc 928 vhost_base { $name:
310 misc 1102 use_ssl => $use_ssl,
311 misc 1103 vhost => $vhost,
312 misc 778 content => template("apache/vhost_reverse_proxy.conf")
313 misc 928 }
314 misc 778 }
315    
316 boklm 280 define webapp_other($webapp_file) {
317 misc 422 include apache::base
318 boklm 280 $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 misc 1065 require => Package['apache-conf'],
327 boklm 280 content => template($webapp_file)
328     }
329     }
330 misc 80 }

  ViewVC Help
Powered by ViewVC 1.1.30