/[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 2487 - (show annotations) (download)
Thu Mar 15 13:52:24 2012 UTC (12 years, 1 month ago) by misc
File size: 6761 byte(s)
split config in a file, to make puppet-lint happy
1 class apache {
2 class base {
3
4 # number of time the log file are rotated before being removed
5 $httpdlogs_rotate = "24"
6
7 $apache_user = 'apache'
8 $apache_group = 'apache'
9
10 package { "apache-mpm-prefork":
11 alias => apache,
12 }
13
14 package { "apache-conf": }
15
16 service { httpd:
17 alias => apache,
18 subscribe => [ Package['apache-mpm-prefork'] ],
19 }
20
21 exec { "service httpd configtest":
22 refreshonly => true,
23 notify => Service["apache"],
24 }
25
26 apache::config {
27 "/etc/httpd/conf.d/customization.conf":
28 content => template("apache/customization.conf");
29 "/etc/httpd/conf/vhosts.d/00_default_vhosts.conf":
30 content => template("apache/00_default_vhosts.conf");
31 }
32
33 file { "/etc/logrotate.d/httpd":
34 content => template("apache/logrotate")
35 }
36 }
37
38 class mod_php inherits base {
39 $php_date_timezone = "UTC"
40
41 package { "apache-mod_php": }
42
43 apache::config { "/etc/httpd/conf.d/mod_php.conf":
44 content => template('apache/mod_php.conf'),
45 }
46 }
47
48 class mod_perl inherits base {
49 package { "apache-mod_perl": }
50 }
51
52 class mod_fcgid inherits base {
53 package { "apache-mod_fcgid": }
54 }
55
56 class mod_fastcgi inherits base {
57 package { "apache-mod_fastcgi": }
58 }
59
60 class mod_ssl inherits base {
61 file { "/etc/ssl/apache/":
62 ensure => directory
63 }
64
65 package { "apache-mod_ssl": }
66
67 apache::config {
68 '/etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf':
69 content => template("apache/01_default_ssl_vhost.conf");
70 "/etc/httpd/conf.d/ssl.conf":
71 content => template("apache/ssl.conf");
72 }
73 }
74
75 class mod_wsgi inherits base {
76 package { "apache-mod_wsgi": }
77
78 file { "/usr/local/lib/wsgi":
79 ensure => directory,
80 }
81
82 apache::config { "/etc/httpd/conf.d/mod_wsgi.conf":
83 content => template('apache/mod_wsgi.conf'),
84 }
85 }
86
87 class mod_proxy inherits base {
88 package { "apache-mod_proxy": }
89 }
90
91 class mod_public_html inherits base {
92 package { "apache-mod_public_html": }
93 }
94
95 class mod_deflate inherits base {
96 package { "apache-mod_deflate": }
97 }
98
99 class mod_geoip inherits base {
100 package { "apache-mod_geoip": }
101 }
102
103 define vhost_base($content = '',
104 $location = '/dev/null',
105 $use_ssl = false,
106 $vhost = false,
107 $aliases = {},
108 $server_aliases = [],
109 $access_logfile = false,
110 $error_logfile = false,
111 $options = [],
112 $enable_public_html = false) {
113 include apache::base
114 $httpd_logdir = "/var/log/httpd"
115
116 if ! $vhost {
117 $real_vhost = $name
118 } else {
119 $real_vhost = $vhost
120 }
121
122 if ! $access_logfile {
123 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
124 } else {
125 $real_access_logfile = $access_logfile
126 }
127 if ! $error_logfile {
128 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
129 } else {
130 $real_error_logfile = $error_logfile
131 }
132
133 if $use_ssl {
134 include apache::mod_ssl
135 if $wildcard_sslcert != 'true' {
136 openssl::self_signed_cert{ "$real_vhost":
137 directory => "/etc/ssl/apache/",
138 before => File["$filename"],
139 }
140 }
141 }
142
143 if $enable_public_html {
144 include apache::mod_public_html
145 }
146
147 $filename = "$name.conf"
148 apache::config { "/etc/httpd/conf/vhosts.d/$filename":
149 content => template("apache/vhost_base.conf")
150 }
151 }
152
153 define vhost_redirect_ssl() {
154 vhost_base { "redirect_ssl_$name":
155 vhost => $name,
156 content => template("apache/vhost_ssl_redirect.conf")
157 }
158 }
159
160 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
161
162 include apache::mod_fastcgi
163 vhost_base { $name:
164 vhost => $vhost,
165 use_ssl => $use_ssl,
166 content => template("apache/vhost_catalyst_app.conf"),
167 }
168 }
169
170 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
171 include apache::mod_wsgi
172 vhost_base { $name:
173 use_ssl => $use_ssl,
174 content => template("apache/vhost_django_app.conf"),
175 aliases => $aliases,
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 mode => 755,
183 notify => Service['apache'],
184 content => template("apache/django.wsgi"),
185 }
186 }
187
188 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
189 include apache::mod_wsgi
190 vhost_base { $name:
191 aliases => $aliases,
192 server_aliases => $server_aliases,
193 content => template("apache/vhost_wsgi.conf"),
194 }
195 }
196
197 define vhost_other_app($vhost_file) {
198 include apache::base
199 apache::config { "/etc/httpd/conf/vhosts.d/$name.conf":
200 content => template($vhost_file),
201 }
202 }
203
204 define vhost_simple($location) {
205 include apache::base
206 vhost_base { $name:
207 location => $location,
208 }
209 }
210
211 define vhost_redirect($url,
212 $vhost = false,
213 $use_ssl = false) {
214 include apache::base
215 vhost_base { $name:
216 use_ssl => $use_ssl,
217 vhost => $vhost,
218 content => template("apache/vhost_redirect.conf"),
219 }
220 }
221
222 define vhost_reverse_proxy($url,
223 $vhost = false,
224 $use_ssl = false) {
225 include apache::mod_proxy
226 vhost_base { $name:
227 use_ssl => $use_ssl,
228 vhost => $vhost,
229 content => template("apache/vhost_reverse_proxy.conf")
230 }
231 }
232
233 define webapp_other($webapp_file) {
234 include apache::base
235 $webappname = $name
236 apache::config { "/etc/httpd/conf/webapps.d/$webappname.conf":
237 content => template($webapp_file),
238 }
239 }
240 }

  ViewVC Help
Powered by ViewVC 1.1.30