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

  ViewVC Help
Powered by ViewVC 1.1.30