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

  ViewVC Help
Powered by ViewVC 1.1.30