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

  ViewVC Help
Powered by ViewVC 1.1.30