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

  ViewVC Help
Powered by ViewVC 1.1.30