/[adm]/puppet/modules/apache/manifests/init.pp
ViewVC logotype

Annotation of /puppet/modules/apache/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30