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

  ViewVC Help
Powered by ViewVC 1.1.30