1 |
misc |
80 |
class apache { |
2 |
misc |
928 |
define vhost_base($content = '', |
3 |
|
|
$location = '/dev/null', |
4 |
|
|
$use_ssl = false, |
5 |
misc |
930 |
$vhost = false, |
6 |
misc |
932 |
$aliases = {}, |
7 |
misc |
935 |
$server_aliases = [], |
8 |
misc |
2225 |
$access_logfile = false, |
9 |
|
|
$error_logfile = false, |
10 |
pterjan |
1599 |
$options = [], |
11 |
misc |
930 |
$enable_public_html = false) { |
12 |
misc |
2225 |
include apache::base |
13 |
|
|
$httpd_logdir = "/var/log/httpd" |
14 |
misc |
2488 |
$filename = "$name.conf" |
15 |
misc |
2225 |
|
16 |
misc |
928 |
if ! $vhost { |
17 |
|
|
$real_vhost = $name |
18 |
|
|
} else { |
19 |
|
|
$real_vhost = $vhost |
20 |
misc |
176 |
} |
21 |
misc |
167 |
|
22 |
misc |
2225 |
if ! $access_logfile { |
23 |
|
|
$real_access_logfile = "$httpd_logdir/${real_vhost}-access_log" |
24 |
|
|
} else { |
25 |
|
|
$real_access_logfile = $access_logfile |
26 |
|
|
} |
27 |
|
|
if ! $error_logfile { |
28 |
|
|
$real_error_logfile = "$httpd_logdir/${real_vhost}-error_log" |
29 |
|
|
} else { |
30 |
|
|
$real_error_logfile = $error_logfile |
31 |
|
|
} |
32 |
boklm |
1630 |
|
33 |
misc |
489 |
if $use_ssl { |
34 |
misc |
2681 |
include apache::mod::ssl |
35 |
misc |
2225 |
if $wildcard_sslcert != 'true' { |
36 |
|
|
openssl::self_signed_cert{ "$real_vhost": |
37 |
|
|
directory => "/etc/ssl/apache/", |
38 |
misc |
2488 |
before => Apache::Config["/etc/httpd/conf/vhosts.d/$filename"], |
39 |
misc |
2225 |
} |
40 |
|
|
} |
41 |
misc |
489 |
} |
42 |
|
|
|
43 |
misc |
930 |
if $enable_public_html { |
44 |
misc |
2682 |
include apache::mod::public_html |
45 |
misc |
930 |
} |
46 |
|
|
|
47 |
misc |
2225 |
apache::config { "/etc/httpd/conf/vhosts.d/$filename": |
48 |
misc |
928 |
content => template("apache/vhost_base.conf") |
49 |
|
|
} |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
define vhost_redirect_ssl() { |
53 |
|
|
vhost_base { "redirect_ssl_$name": |
54 |
|
|
vhost => $name, |
55 |
|
|
content => template("apache/vhost_ssl_redirect.conf") |
56 |
|
|
} |
57 |
|
|
} |
58 |
|
|
|
59 |
boklm |
1617 |
define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false, $vhost = false) { |
60 |
misc |
928 |
|
61 |
misc |
2684 |
include apache::mod::fastcgi |
62 |
misc |
928 |
vhost_base { $name: |
63 |
misc |
2225 |
vhost => $vhost, |
64 |
misc |
928 |
use_ssl => $use_ssl, |
65 |
misc |
2225 |
content => template("apache/vhost_catalyst_app.conf"), |
66 |
misc |
167 |
} |
67 |
|
|
} |
68 |
misc |
182 |
|
69 |
misc |
1193 |
define vhost_django_app($module = false, $module_path = false, $use_ssl = false, $aliases= {}) { |
70 |
misc |
2686 |
include apache::mod::wsgi |
71 |
misc |
928 |
vhost_base { $name: |
72 |
misc |
934 |
use_ssl => $use_ssl, |
73 |
misc |
1193 |
content => template("apache/vhost_django_app.conf"), |
74 |
|
|
aliases => $aliases, |
75 |
misc |
621 |
} |
76 |
misc |
928 |
|
77 |
misc |
612 |
# module is a ruby reserved keyword, cannot be used in templates |
78 |
|
|
$django_module = $module |
79 |
misc |
182 |
file { "$name.wsgi": |
80 |
misc |
201 |
path => "/usr/local/lib/wsgi/$name.wsgi", |
81 |
misc |
182 |
mode => 755, |
82 |
|
|
notify => Service['apache'], |
83 |
misc |
2225 |
content => template("apache/django.wsgi"), |
84 |
misc |
182 |
} |
85 |
|
|
} |
86 |
boklm |
280 |
|
87 |
misc |
935 |
define vhost_wsgi($wsgi_path, $aliases = {}, $server_aliases = []) { |
88 |
misc |
2686 |
include apache::mod::wsgi |
89 |
misc |
933 |
vhost_base { $name: |
90 |
|
|
aliases => $aliases, |
91 |
misc |
935 |
server_aliases => $server_aliases, |
92 |
misc |
2225 |
content => template("apache/vhost_wsgi.conf"), |
93 |
misc |
812 |
} |
94 |
|
|
} |
95 |
|
|
|
96 |
boklm |
280 |
define vhost_other_app($vhost_file) { |
97 |
misc |
412 |
include apache::base |
98 |
misc |
2225 |
apache::config { "/etc/httpd/conf/vhosts.d/$name.conf": |
99 |
|
|
content => template($vhost_file), |
100 |
boklm |
280 |
} |
101 |
|
|
} |
102 |
|
|
|
103 |
misc |
742 |
define vhost_simple($location) { |
104 |
|
|
include apache::base |
105 |
misc |
928 |
vhost_base { $name: |
106 |
|
|
location => $location, |
107 |
|
|
} |
108 |
misc |
742 |
} |
109 |
|
|
|
110 |
boklm |
1319 |
define vhost_redirect($url, |
111 |
misc |
2225 |
$vhost = false, |
112 |
|
|
$use_ssl = false) { |
113 |
misc |
931 |
include apache::base |
114 |
|
|
vhost_base { $name: |
115 |
boklm |
1319 |
use_ssl => $use_ssl, |
116 |
|
|
vhost => $vhost, |
117 |
misc |
931 |
content => template("apache/vhost_redirect.conf"), |
118 |
|
|
} |
119 |
|
|
} |
120 |
|
|
|
121 |
misc |
1103 |
define vhost_reverse_proxy($url, |
122 |
|
|
$vhost = false, |
123 |
|
|
$use_ssl = false) { |
124 |
misc |
2682 |
include apache::mod::proxy |
125 |
misc |
928 |
vhost_base { $name: |
126 |
misc |
1102 |
use_ssl => $use_ssl, |
127 |
misc |
1103 |
vhost => $vhost, |
128 |
misc |
778 |
content => template("apache/vhost_reverse_proxy.conf") |
129 |
misc |
928 |
} |
130 |
misc |
778 |
} |
131 |
|
|
|
132 |
misc |
80 |
} |