/[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 1635 - (show annotations) (download)
Tue May 24 10:21:10 2011 UTC (12 years, 11 months ago) by boklm
File size: 8475 byte(s)
add logrotate config
1 class apache {
2
3 class base {
4 $php_date_timezone = "UTC"
5
6 package { "apache-mpm-prefork":
7 alias => apache,
8 ensure => installed
9 }
10
11 package { "apache-conf":
12 ensure => installed,
13 }
14
15 service { httpd:
16 alias => apache,
17 ensure => running,
18 subscribe => [ Package['apache-mpm-prefork'] ],
19 }
20
21 file { "customization.conf":
22 ensure => present,
23 path => "/etc/httpd/conf.d/customization.conf",
24 content => template("apache/customization.conf"),
25 require => Package["apache-conf"],
26 notify => Service["apache"],
27 owner => root,
28 group => root,
29 mode => 644,
30 }
31
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 require => Package["apache-conf"],
40 content => template("apache/00_default_vhosts.conf")
41 }
42
43 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 }
52
53 class mod_php inherits base {
54 package { "apache-mod_php":
55 ensure => installed
56 }
57
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 content => template('apache/mod_php.conf'),
65 notify => Service['apache'],
66 }
67 }
68
69 class mod_perl inherits base {
70 package { "apache-mod_perl":
71 ensure => installed
72 }
73 }
74
75 class mod_fcgid inherits base {
76 package { "apache-mod_fcgid":
77 ensure => installed
78 }
79 }
80
81 class mod_fastcgi inherits base {
82 package { "apache-mod_fastcgi":
83 ensure => installed
84 }
85 }
86
87 class mod_ssl inherits base {
88 file { "/etc/ssl/apache/":
89 ensure => directory
90 }
91
92 package { "apache-mod_ssl":
93 ensure => installed
94 }
95
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 }
107
108 class mod_wsgi inherits base {
109 package { "apache-mod_wsgi":
110 ensure => installed
111 }
112
113 file { "/usr/local/lib/wsgi":
114 ensure => directory,
115 owner => root,
116 group => root,
117 mode => 644,
118 }
119
120 file { "/etc/httpd/conf.d/mod_wsgi.conf":
121 ensure => present,
122 owner => root,
123 group => root,
124 mode => 644,
125 require => Package['apache-conf'],
126 content => template('apache/mod_wsgi.conf'),
127 notify => Service['apache'],
128 }
129
130 }
131
132 class mod_proxy inherits base {
133 package { "apache-mod_proxy":
134 ensure => installed
135 }
136 }
137
138 class mod_public_html inherits base {
139 package { "apache-mod_public_html":
140 ensure => installed
141 }
142 }
143
144 class mod_deflate inherits base {
145 package { "apache-mod_deflate":
146 ensure => installed
147 }
148 }
149
150 define vhost_base($content = '',
151 $location = '/dev/null',
152 $use_ssl = false,
153 $vhost = false,
154 $aliases = {},
155 $server_aliases = [],
156 $access_logfile = false,
157 $error_logfile = false,
158 $options = [],
159 $enable_public_html = false) {
160 include apache::base
161 $httpd_logdir = "/var/log/httpd"
162 if ! $vhost {
163 $real_vhost = $name
164 } else {
165 $real_vhost = $vhost
166 }
167
168 if ! $access_logfile {
169 $real_access_logfile = "$httpd_logdir/$real_vhost-access_log"
170 } else {
171 $real_access_logfile = $access_logfile
172 }
173 if ! $error_logfile {
174 $real_error_logfile = "$httpd_logdir/$real_vhost-error_log"
175 } else {
176 $real_error_logfile = $error_logfile
177 }
178
179 if $use_ssl {
180 include apache::mod_ssl
181 if $wildcard_sslcert != 'true' {
182 openssl::self_signed_cert{ "$real_vhost":
183 directory => "/etc/ssl/apache/",
184 before => File["$filename"],
185 }
186 }
187 }
188
189 if $enable_public_html {
190 include apache::mod_public_html
191 }
192
193 $filename = "$name.conf"
194 file { "$filename":
195 path => "/etc/httpd/conf/vhosts.d/$filename",
196 ensure => "present",
197 owner => root,
198 group => root,
199 mode => 644,
200 notify => Service['apache'],
201 require => Package['apache-conf'],
202 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 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
214
215 include apache::mod_fastcgi
216 vhost_base { $name:
217 vhost => $vhost,
218 use_ssl => $use_ssl,
219 content => template("apache/vhost_catalyst_app.conf")
220 }
221 }
222
223 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
224 include apache::mod_wsgi
225 vhost_base { $name:
226 use_ssl => $use_ssl,
227 content => template("apache/vhost_django_app.conf"),
228 aliases => $aliases,
229 }
230
231 # module is a ruby reserved keyword, cannot be used in templates
232 $django_module = $module
233 file { "$name.wsgi":
234 path => "/usr/local/lib/wsgi/$name.wsgi",
235 ensure => "present",
236 owner => root,
237 group => root,
238 mode => 755,
239 notify => Service['apache'],
240 content => template("apache/django.wsgi")
241 }
242 }
243
244 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
245 include apache::mod_wsgi
246 vhost_base { $name:
247 aliases => $aliases,
248 server_aliases => $server_aliases,
249 content => template("apache/vhost_wsgi.conf")
250 }
251 }
252
253 define vhost_other_app($vhost_file) {
254 include apache::base
255 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 require => Package['apache-conf'],
263 content => template($vhost_file)
264 }
265 }
266
267 define vhost_simple($location) {
268 include apache::base
269 vhost_base { $name:
270 location => $location,
271 }
272 }
273
274 define vhost_redirect($url,
275 $vhost = false,
276 $use_ssl = false) {
277 include apache::base
278 vhost_base { $name:
279 use_ssl => $use_ssl,
280 vhost => $vhost,
281 content => template("apache/vhost_redirect.conf"),
282 }
283 }
284
285 define vhost_reverse_proxy($url,
286 $vhost = false,
287 $use_ssl = false) {
288 include apache::mod_proxy
289 vhost_base { $name:
290 use_ssl => $use_ssl,
291 vhost => $vhost,
292 content => template("apache/vhost_reverse_proxy.conf")
293 }
294 }
295
296 define webapp_other($webapp_file) {
297 include apache::base
298 $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 require => Package['apache-conf'],
307 content => template($webapp_file)
308 }
309 }
310 }

  ViewVC Help
Powered by ViewVC 1.1.30