/[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 1636 - (hide annotations) (download)
Tue May 24 10:25:22 2011 UTC (12 years, 11 months ago) by boklm
File size: 8566 byte(s)
keep httpd logs for 24 months
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 misc 192 }
110    
111 misc 80 class mod_wsgi inherits base {
112     package { "apache-mod_wsgi":
113     ensure => installed
114     }
115 misc 182
116 misc 201 file { "/usr/local/lib/wsgi":
117 misc 182 ensure => directory,
118     owner => root,
119     group => root,
120     mode => 644,
121     }
122 misc 908
123     file { "/etc/httpd/conf.d/mod_wsgi.conf":
124     ensure => present,
125     owner => root,
126     group => root,
127     mode => 644,
128 misc 1065 require => Package['apache-conf'],
129 misc 1188 content => template('apache/mod_wsgi.conf'),
130 misc 1186 notify => Service['apache'],
131 misc 908 }
132    
133 misc 80 }
134 misc 778
135     class mod_proxy inherits base {
136     package { "apache-mod_proxy":
137     ensure => installed
138     }
139     }
140 misc 167
141 misc 929 class mod_public_html inherits base {
142     package { "apache-mod_public_html":
143     ensure => installed
144     }
145     }
146    
147 dams 1021 class mod_deflate inherits base {
148     package { "apache-mod_deflate":
149     ensure => installed
150     }
151     }
152    
153 misc 928 define vhost_base($content = '',
154     $location = '/dev/null',
155     $use_ssl = false,
156 misc 930 $vhost = false,
157 misc 932 $aliases = {},
158 misc 935 $server_aliases = [],
159 boklm 1630 $access_logfile = false,
160     $error_logfile = false,
161 pterjan 1599 $options = [],
162 misc 930 $enable_public_html = false) {
163 boklm 1464 include apache::base
164 boklm 1633 $httpd_logdir = "/var/log/httpd"
165 misc 928 if ! $vhost {
166     $real_vhost = $name
167     } else {
168     $real_vhost = $vhost
169 misc 176 }
170 misc 167
171 boklm 1630 if ! $access_logfile {
172 boklm 1634 $real_access_logfile = "$httpd_logdir/$real_vhost-access_log"
173 boklm 1632 } else {
174     $real_access_logfile = $access_logfile
175 boklm 1630 }
176     if ! $error_logfile {
177 boklm 1634 $real_error_logfile = "$httpd_logdir/$real_vhost-error_log"
178 boklm 1632 } else {
179     $real_error_logfile = $error_logfile
180 boklm 1630 }
181    
182 misc 489 if $use_ssl {
183     include apache::mod_ssl
184 boklm 1248 if $wildcard_sslcert != 'true' {
185 boklm 1237 openssl::self_signed_cert{ "$real_vhost":
186     directory => "/etc/ssl/apache/",
187     before => File["$filename"],
188     }
189     }
190 misc 489 }
191    
192 misc 930 if $enable_public_html {
193     include apache::mod_public_html
194     }
195    
196 misc 928 $filename = "$name.conf"
197     file { "$filename":
198     path => "/etc/httpd/conf/vhosts.d/$filename",
199 misc 167 ensure => "present",
200     owner => root,
201     group => root,
202     mode => 644,
203     notify => Service['apache'],
204 misc 1065 require => Package['apache-conf'],
205 misc 928 content => template("apache/vhost_base.conf")
206     }
207     }
208    
209     define vhost_redirect_ssl() {
210     vhost_base { "redirect_ssl_$name":
211     vhost => $name,
212     content => template("apache/vhost_ssl_redirect.conf")
213     }
214     }
215    
216 boklm 1617 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
217 misc 928
218     include apache::mod_fastcgi
219     vhost_base { $name:
220 boklm 1617 vhost => $vhost,
221 misc 928 use_ssl => $use_ssl,
222 misc 167 content => template("apache/vhost_catalyst_app.conf")
223     }
224     }
225 misc 182
226 misc 1193 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
227 misc 182 include apache::mod_wsgi
228 misc 928 vhost_base { $name:
229 misc 934 use_ssl => $use_ssl,
230 misc 1193 content => template("apache/vhost_django_app.conf"),
231     aliases => $aliases,
232 misc 621 }
233 misc 928
234 misc 612 # module is a ruby reserved keyword, cannot be used in templates
235     $django_module = $module
236 misc 182 file { "$name.wsgi":
237 misc 201 path => "/usr/local/lib/wsgi/$name.wsgi",
238 misc 182 ensure => "present",
239     owner => root,
240     group => root,
241     mode => 755,
242     notify => Service['apache'],
243     content => template("apache/django.wsgi")
244     }
245     }
246 boklm 280
247 misc 935 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
248 misc 812 include apache::mod_wsgi
249 misc 933 vhost_base { $name:
250     aliases => $aliases,
251 misc 935 server_aliases => $server_aliases,
252 misc 812 content => template("apache/vhost_wsgi.conf")
253     }
254     }
255    
256 boklm 280 define vhost_other_app($vhost_file) {
257 misc 412 include apache::base
258 boklm 280 file { "$name.conf":
259     path => "/etc/httpd/conf/vhosts.d/$name.conf",
260     ensure => "present",
261     owner => root,
262     group => root,
263     mode => 644,
264     notify => Service['apache'],
265 misc 1065 require => Package['apache-conf'],
266 boklm 280 content => template($vhost_file)
267     }
268     }
269    
270 misc 742 define vhost_simple($location) {
271     include apache::base
272 misc 928 vhost_base { $name:
273     location => $location,
274     }
275 misc 742 }
276    
277 boklm 1319 define vhost_redirect($url,
278     $vhost = false,
279     $use_ssl = false) {
280 misc 931 include apache::base
281     vhost_base { $name:
282 boklm 1319 use_ssl => $use_ssl,
283     vhost => $vhost,
284 misc 931 content => template("apache/vhost_redirect.conf"),
285     }
286     }
287    
288 misc 1103 define vhost_reverse_proxy($url,
289     $vhost = false,
290     $use_ssl = false) {
291 misc 778 include apache::mod_proxy
292 misc 928 vhost_base { $name:
293 misc 1102 use_ssl => $use_ssl,
294 misc 1103 vhost => $vhost,
295 misc 778 content => template("apache/vhost_reverse_proxy.conf")
296 misc 928 }
297 misc 778 }
298    
299 boklm 280 define webapp_other($webapp_file) {
300 misc 422 include apache::base
301 boklm 280 $webappname = $name
302     file { "webapp_$name.conf":
303     path => "/etc/httpd/conf/webapps.d/$webappname.conf",
304     ensure => "present",
305     owner => root,
306     group => root,
307     mode => 644,
308     notify => Service['apache'],
309 misc 1065 require => Package['apache-conf'],
310 boklm 280 content => template($webapp_file)
311     }
312     }
313 misc 80 }

  ViewVC Help
Powered by ViewVC 1.1.30