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

  ViewVC Help
Powered by ViewVC 1.1.30