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

  ViewVC Help
Powered by ViewVC 1.1.30