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

  ViewVC Help
Powered by ViewVC 1.1.30