/[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 2681 - (show annotations) (download)
Sun Mar 25 12:20:20 2012 UTC (12 years ago) by misc
File size: 6367 byte(s)
fix usage of mod::ssl on other manifests
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_wsgi inherits base {
61 package { "apache-mod_wsgi": }
62
63 file { "/usr/local/lib/wsgi":
64 ensure => directory,
65 }
66
67 apache::config { "/etc/httpd/conf.d/mod_wsgi.conf":
68 content => template('apache/mod_wsgi.conf'),
69 }
70 }
71
72 class mod_proxy inherits base {
73 package { "apache-mod_proxy": }
74 }
75
76 class mod_public_html inherits base {
77 package { "apache-mod_public_html": }
78 }
79
80 class mod_deflate inherits base {
81 package { "apache-mod_deflate": }
82 }
83
84 class mod_geoip inherits base {
85 package { "apache-mod_geoip": }
86 }
87
88 define vhost_base($content = '',
89 $location = '/dev/null',
90 $use_ssl = false,
91 $vhost = false,
92 $aliases = {},
93 $server_aliases = [],
94 $access_logfile = false,
95 $error_logfile = false,
96 $options = [],
97 $enable_public_html = false) {
98 include apache::base
99 $httpd_logdir = "/var/log/httpd"
100 $filename = "$name.conf"
101
102 if ! $vhost {
103 $real_vhost = $name
104 } else {
105 $real_vhost = $vhost
106 }
107
108 if ! $access_logfile {
109 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
110 } else {
111 $real_access_logfile = $access_logfile
112 }
113 if ! $error_logfile {
114 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
115 } else {
116 $real_error_logfile = $error_logfile
117 }
118
119 if $use_ssl {
120 include apache::mod::ssl
121 if $wildcard_sslcert != 'true' {
122 openssl::self_signed_cert{ "$real_vhost":
123 directory => "/etc/ssl/apache/",
124 before => Apache::Config["/etc/httpd/conf/vhosts.d/$filename"],
125 }
126 }
127 }
128
129 if $enable_public_html {
130 include apache::mod_public_html
131 }
132
133 apache::config { "/etc/httpd/conf/vhosts.d/$filename":
134 content => template("apache/vhost_base.conf")
135 }
136 }
137
138 define vhost_redirect_ssl() {
139 vhost_base { "redirect_ssl_$name":
140 vhost => $name,
141 content => template("apache/vhost_ssl_redirect.conf")
142 }
143 }
144
145 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
146
147 include apache::mod_fastcgi
148 vhost_base { $name:
149 vhost => $vhost,
150 use_ssl => $use_ssl,
151 content => template("apache/vhost_catalyst_app.conf"),
152 }
153 }
154
155 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
156 include apache::mod_wsgi
157 vhost_base { $name:
158 use_ssl => $use_ssl,
159 content => template("apache/vhost_django_app.conf"),
160 aliases => $aliases,
161 }
162
163 # module is a ruby reserved keyword, cannot be used in templates
164 $django_module = $module
165 file { "$name.wsgi":
166 path => "/usr/local/lib/wsgi/$name.wsgi",
167 mode => 755,
168 notify => Service['apache'],
169 content => template("apache/django.wsgi"),
170 }
171 }
172
173 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
174 include apache::mod_wsgi
175 vhost_base { $name:
176 aliases => $aliases,
177 server_aliases => $server_aliases,
178 content => template("apache/vhost_wsgi.conf"),
179 }
180 }
181
182 define vhost_other_app($vhost_file) {
183 include apache::base
184 apache::config { "/etc/httpd/conf/vhosts.d/$name.conf":
185 content => template($vhost_file),
186 }
187 }
188
189 define vhost_simple($location) {
190 include apache::base
191 vhost_base { $name:
192 location => $location,
193 }
194 }
195
196 define vhost_redirect($url,
197 $vhost = false,
198 $use_ssl = false) {
199 include apache::base
200 vhost_base { $name:
201 use_ssl => $use_ssl,
202 vhost => $vhost,
203 content => template("apache/vhost_redirect.conf"),
204 }
205 }
206
207 define vhost_reverse_proxy($url,
208 $vhost = false,
209 $use_ssl = false) {
210 include apache::mod_proxy
211 vhost_base { $name:
212 use_ssl => $use_ssl,
213 vhost => $vhost,
214 content => template("apache/vhost_reverse_proxy.conf")
215 }
216 }
217
218 define webapp_other($webapp_file) {
219 include apache::base
220 $webappname = $name
221 apache::config { "/etc/httpd/conf/webapps.d/$webappname.conf":
222 content => template($webapp_file),
223 }
224 }
225 }

  ViewVC Help
Powered by ViewVC 1.1.30