/[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 2085 - (show annotations) (download)
Wed Nov 9 22:14:05 2011 UTC (12 years, 5 months ago) by boklm
File size: 8908 byte(s)
only add NameVirtualHost on port 443 when mod_ssl has been selected
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 define vhost_base($content = '',
165 $location = '/dev/null',
166 $use_ssl = false,
167 $vhost = false,
168 $aliases = {},
169 $server_aliases = [],
170 $access_logfile = false,
171 $error_logfile = false,
172 $options = [],
173 $enable_public_html = false) {
174 include apache::base
175 $httpd_logdir = "/var/log/httpd"
176 if ! $vhost {
177 $real_vhost = $name
178 } else {
179 $real_vhost = $vhost
180 }
181
182 if ! $access_logfile {
183 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
184 } else {
185 $real_access_logfile = $access_logfile
186 }
187 if ! $error_logfile {
188 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
189 } else {
190 $real_error_logfile = $error_logfile
191 }
192
193 if $use_ssl {
194 include apache::mod_ssl
195 if $wildcard_sslcert != 'true' {
196 openssl::self_signed_cert{ "$real_vhost":
197 directory => "/etc/ssl/apache/",
198 before => File["$filename"],
199 }
200 }
201 }
202
203 if $enable_public_html {
204 include apache::mod_public_html
205 }
206
207 $filename = "$name.conf"
208 file { "$filename":
209 path => "/etc/httpd/conf/vhosts.d/$filename",
210 ensure => "present",
211 owner => root,
212 group => root,
213 mode => 644,
214 notify => Service['apache'],
215 require => Package['apache-conf'],
216 content => template("apache/vhost_base.conf")
217 }
218 }
219
220 define vhost_redirect_ssl() {
221 vhost_base { "redirect_ssl_$name":
222 vhost => $name,
223 content => template("apache/vhost_ssl_redirect.conf")
224 }
225 }
226
227 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
228
229 include apache::mod_fastcgi
230 vhost_base { $name:
231 vhost => $vhost,
232 use_ssl => $use_ssl,
233 content => template("apache/vhost_catalyst_app.conf")
234 }
235 }
236
237 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
238 include apache::mod_wsgi
239 vhost_base { $name:
240 use_ssl => $use_ssl,
241 content => template("apache/vhost_django_app.conf"),
242 aliases => $aliases,
243 }
244
245 # module is a ruby reserved keyword, cannot be used in templates
246 $django_module = $module
247 file { "$name.wsgi":
248 path => "/usr/local/lib/wsgi/$name.wsgi",
249 ensure => "present",
250 owner => root,
251 group => root,
252 mode => 755,
253 notify => Service['apache'],
254 content => template("apache/django.wsgi")
255 }
256 }
257
258 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
259 include apache::mod_wsgi
260 vhost_base { $name:
261 aliases => $aliases,
262 server_aliases => $server_aliases,
263 content => template("apache/vhost_wsgi.conf")
264 }
265 }
266
267 define vhost_other_app($vhost_file) {
268 include apache::base
269 file { "$name.conf":
270 path => "/etc/httpd/conf/vhosts.d/$name.conf",
271 ensure => "present",
272 owner => root,
273 group => root,
274 mode => 644,
275 notify => Service['apache'],
276 require => Package['apache-conf'],
277 content => template($vhost_file)
278 }
279 }
280
281 define vhost_simple($location) {
282 include apache::base
283 vhost_base { $name:
284 location => $location,
285 }
286 }
287
288 define vhost_redirect($url,
289 $vhost = false,
290 $use_ssl = false) {
291 include apache::base
292 vhost_base { $name:
293 use_ssl => $use_ssl,
294 vhost => $vhost,
295 content => template("apache/vhost_redirect.conf"),
296 }
297 }
298
299 define vhost_reverse_proxy($url,
300 $vhost = false,
301 $use_ssl = false) {
302 include apache::mod_proxy
303 vhost_base { $name:
304 use_ssl => $use_ssl,
305 vhost => $vhost,
306 content => template("apache/vhost_reverse_proxy.conf")
307 }
308 }
309
310 define webapp_other($webapp_file) {
311 include apache::base
312 $webappname = $name
313 file { "webapp_$name.conf":
314 path => "/etc/httpd/conf/webapps.d/$webappname.conf",
315 ensure => "present",
316 owner => root,
317 group => root,
318 mode => 644,
319 notify => Service['apache'],
320 require => Package['apache-conf'],
321 content => template($webapp_file)
322 }
323 }
324 }

  ViewVC Help
Powered by ViewVC 1.1.30