/[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 2552 - (show annotations) (download)
Sat Mar 17 01:25:04 2012 UTC (12 years, 1 month ago) by misc
File size: 6993 byte(s)
manage the certificate used for default connexion too, since that's the one that xymon check for expiry ( and that's also what openssl does ). Probably a issue with SNI, didn't look more in details for tonight
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 openssl::self_signed_cert{ 'localhost':
66 directory => '/etc/ssl/apache/',
67 before => Apache::Config['/etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf'],
68 }
69
70 package { "apache-mod_ssl": }
71
72 apache::config {
73 '/etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf':
74 content => template("apache/01_default_ssl_vhost.conf");
75 "/etc/httpd/conf.d/ssl.conf":
76 content => template("apache/ssl.conf");
77 }
78 }
79
80 class mod_wsgi inherits base {
81 package { "apache-mod_wsgi": }
82
83 file { "/usr/local/lib/wsgi":
84 ensure => directory,
85 }
86
87 apache::config { "/etc/httpd/conf.d/mod_wsgi.conf":
88 content => template('apache/mod_wsgi.conf'),
89 }
90 }
91
92 class mod_proxy inherits base {
93 package { "apache-mod_proxy": }
94 }
95
96 class mod_public_html inherits base {
97 package { "apache-mod_public_html": }
98 }
99
100 class mod_deflate inherits base {
101 package { "apache-mod_deflate": }
102 }
103
104 class mod_geoip inherits base {
105 package { "apache-mod_geoip": }
106 }
107
108 define vhost_base($content = '',
109 $location = '/dev/null',
110 $use_ssl = false,
111 $vhost = false,
112 $aliases = {},
113 $server_aliases = [],
114 $access_logfile = false,
115 $error_logfile = false,
116 $options = [],
117 $enable_public_html = false) {
118 include apache::base
119 $httpd_logdir = "/var/log/httpd"
120 $filename = "$name.conf"
121
122 if ! $vhost {
123 $real_vhost = $name
124 } else {
125 $real_vhost = $vhost
126 }
127
128 if ! $access_logfile {
129 $real_access_logfile = "$httpd_logdir/${real_vhost}-access_log"
130 } else {
131 $real_access_logfile = $access_logfile
132 }
133 if ! $error_logfile {
134 $real_error_logfile = "$httpd_logdir/${real_vhost}-error_log"
135 } else {
136 $real_error_logfile = $error_logfile
137 }
138
139 if $use_ssl {
140 include apache::mod_ssl
141 if $wildcard_sslcert != 'true' {
142 openssl::self_signed_cert{ "$real_vhost":
143 directory => "/etc/ssl/apache/",
144 before => Apache::Config["/etc/httpd/conf/vhosts.d/$filename"],
145 }
146 }
147 }
148
149 if $enable_public_html {
150 include apache::mod_public_html
151 }
152
153 apache::config { "/etc/httpd/conf/vhosts.d/$filename":
154 content => template("apache/vhost_base.conf")
155 }
156 }
157
158 define vhost_redirect_ssl() {
159 vhost_base { "redirect_ssl_$name":
160 vhost => $name,
161 content => template("apache/vhost_ssl_redirect.conf")
162 }
163 }
164
165 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
166
167 include apache::mod_fastcgi
168 vhost_base { $name:
169 vhost => $vhost,
170 use_ssl => $use_ssl,
171 content => template("apache/vhost_catalyst_app.conf"),
172 }
173 }
174
175 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
176 include apache::mod_wsgi
177 vhost_base { $name:
178 use_ssl => $use_ssl,
179 content => template("apache/vhost_django_app.conf"),
180 aliases => $aliases,
181 }
182
183 # module is a ruby reserved keyword, cannot be used in templates
184 $django_module = $module
185 file { "$name.wsgi":
186 path => "/usr/local/lib/wsgi/$name.wsgi",
187 mode => 755,
188 notify => Service['apache'],
189 content => template("apache/django.wsgi"),
190 }
191 }
192
193 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
194 include apache::mod_wsgi
195 vhost_base { $name:
196 aliases => $aliases,
197 server_aliases => $server_aliases,
198 content => template("apache/vhost_wsgi.conf"),
199 }
200 }
201
202 define vhost_other_app($vhost_file) {
203 include apache::base
204 apache::config { "/etc/httpd/conf/vhosts.d/$name.conf":
205 content => template($vhost_file),
206 }
207 }
208
209 define vhost_simple($location) {
210 include apache::base
211 vhost_base { $name:
212 location => $location,
213 }
214 }
215
216 define vhost_redirect($url,
217 $vhost = false,
218 $use_ssl = false) {
219 include apache::base
220 vhost_base { $name:
221 use_ssl => $use_ssl,
222 vhost => $vhost,
223 content => template("apache/vhost_redirect.conf"),
224 }
225 }
226
227 define vhost_reverse_proxy($url,
228 $vhost = false,
229 $use_ssl = false) {
230 include apache::mod_proxy
231 vhost_base { $name:
232 use_ssl => $use_ssl,
233 vhost => $vhost,
234 content => template("apache/vhost_reverse_proxy.conf")
235 }
236 }
237
238 define webapp_other($webapp_file) {
239 include apache::base
240 $webappname = $name
241 apache::config { "/etc/httpd/conf/webapps.d/$webappname.conf":
242 content => template($webapp_file),
243 }
244 }
245 }

  ViewVC Help
Powered by ViewVC 1.1.30