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

  ViewVC Help
Powered by ViewVC 1.1.30