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

  ViewVC Help
Powered by ViewVC 1.1.30