/[adm]/puppet/modules/apache/manifests/init.pp
ViewVC logotype

Annotation of /puppet/modules/apache/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2682 - (hide 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 misc 80 class apache {
2     class base {
3 boklm 1500
4 misc 2225 # number of time the log file are rotated before being removed
5     $httpdlogs_rotate = "24"
6 boklm 1636
7 misc 2225 $apache_user = 'apache'
8     $apache_group = 'apache'
9 boklm 2104
10 misc 80 package { "apache-mpm-prefork":
11 misc 117 alias => apache,
12 misc 80 }
13    
14 misc 2225 package { "apache-conf": }
15 misc 1065
16 misc 96 service { httpd:
17     alias => apache,
18 misc 80 subscribe => [ Package['apache-mpm-prefork'] ],
19     }
20 misc 117
21 misc 2243 exec { "service httpd configtest":
22     refreshonly => true,
23     notify => Service["apache"],
24     }
25    
26 misc 2225 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 misc 117 }
32 boklm 207
33 misc 2225 file { "/etc/logrotate.d/httpd":
34     content => template("apache/logrotate")
35 boklm 207 }
36 misc 80 }
37    
38     class mod_php inherits base {
39 misc 2124 $php_date_timezone = "UTC"
40 misc 1185
41 misc 2225 package { "apache-mod_php": }
42    
43     apache::config { "/etc/httpd/conf.d/mod_php.conf":
44 misc 1188 content => template('apache/mod_php.conf'),
45 misc 1185 }
46 misc 80 }
47    
48     class mod_wsgi inherits base {
49 misc 2225 package { "apache-mod_wsgi": }
50 misc 182
51 misc 201 file { "/usr/local/lib/wsgi":
52 misc 182 ensure => directory,
53     }
54 misc 908
55 misc 2225 apache::config { "/etc/httpd/conf.d/mod_wsgi.conf":
56 misc 1188 content => template('apache/mod_wsgi.conf'),
57 misc 908 }
58 misc 2225 }
59 misc 908
60 misc 167
61 misc 928 define vhost_base($content = '',
62     $location = '/dev/null',
63     $use_ssl = false,
64 misc 930 $vhost = false,
65 misc 932 $aliases = {},
66 misc 935 $server_aliases = [],
67 misc 2225 $access_logfile = false,
68     $error_logfile = false,
69 pterjan 1599 $options = [],
70 misc 930 $enable_public_html = false) {
71 misc 2225 include apache::base
72     $httpd_logdir = "/var/log/httpd"
73 misc 2488 $filename = "$name.conf"
74 misc 2225
75 misc 928 if ! $vhost {
76     $real_vhost = $name
77     } else {
78     $real_vhost = $vhost
79 misc 176 }
80 misc 167
81 misc 2225 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 boklm 1630
92 misc 489 if $use_ssl {
93 misc 2681 include apache::mod::ssl
94 misc 2225 if $wildcard_sslcert != 'true' {
95     openssl::self_signed_cert{ "$real_vhost":
96     directory => "/etc/ssl/apache/",
97 misc 2488 before => Apache::Config["/etc/httpd/conf/vhosts.d/$filename"],
98 misc 2225 }
99     }
100 misc 489 }
101    
102 misc 930 if $enable_public_html {
103 misc 2682 include apache::mod::public_html
104 misc 930 }
105    
106 misc 2225 apache::config { "/etc/httpd/conf/vhosts.d/$filename":
107 misc 928 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 boklm 1617 define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) {
119 misc 928
120     include apache::mod_fastcgi
121     vhost_base { $name:
122 misc 2225 vhost => $vhost,
123 misc 928 use_ssl => $use_ssl,
124 misc 2225 content => template("apache/vhost_catalyst_app.conf"),
125 misc 167 }
126     }
127 misc 182
128 misc 1193 define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) {
129 misc 182 include apache::mod_wsgi
130 misc 928 vhost_base { $name:
131 misc 934 use_ssl => $use_ssl,
132 misc 1193 content => template("apache/vhost_django_app.conf"),
133     aliases => $aliases,
134 misc 621 }
135 misc 928
136 misc 612 # module is a ruby reserved keyword, cannot be used in templates
137     $django_module = $module
138 misc 182 file { "$name.wsgi":
139 misc 201 path => "/usr/local/lib/wsgi/$name.wsgi",
140 misc 182 mode => 755,
141     notify => Service['apache'],
142 misc 2225 content => template("apache/django.wsgi"),
143 misc 182 }
144     }
145 boklm 280
146 misc 935 define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) {
147 misc 812 include apache::mod_wsgi
148 misc 933 vhost_base { $name:
149     aliases => $aliases,
150 misc 935 server_aliases => $server_aliases,
151 misc 2225 content => template("apache/vhost_wsgi.conf"),
152 misc 812 }
153     }
154    
155 boklm 280 define vhost_other_app($vhost_file) {
156 misc 412 include apache::base
157 misc 2225 apache::config { "/etc/httpd/conf/vhosts.d/$name.conf":
158     content => template($vhost_file),
159 boklm 280 }
160     }
161    
162 misc 742 define vhost_simple($location) {
163     include apache::base
164 misc 928 vhost_base { $name:
165     location => $location,
166     }
167 misc 742 }
168    
169 boklm 1319 define vhost_redirect($url,
170 misc 2225 $vhost = false,
171     $use_ssl = false) {
172 misc 931 include apache::base
173     vhost_base { $name:
174 boklm 1319 use_ssl => $use_ssl,
175     vhost => $vhost,
176 misc 931 content => template("apache/vhost_redirect.conf"),
177     }
178     }
179    
180 misc 1103 define vhost_reverse_proxy($url,
181     $vhost = false,
182     $use_ssl = false) {
183 misc 2682 include apache::mod::proxy
184 misc 928 vhost_base { $name:
185 misc 1102 use_ssl => $use_ssl,
186 misc 1103 vhost => $vhost,
187 misc 778 content => template("apache/vhost_reverse_proxy.conf")
188 misc 928 }
189 misc 778 }
190    
191 misc 2225 define webapp_other($webapp_file) {
192 misc 422 include apache::base
193 boklm 280 $webappname = $name
194 misc 2225 apache::config { "/etc/httpd/conf/webapps.d/$webappname.conf":
195     content => template($webapp_file),
196 boklm 280 }
197 misc 2225 }
198 misc 80 }

  ViewVC Help
Powered by ViewVC 1.1.30