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

  ViewVC Help
Powered by ViewVC 1.1.30