1 |
define apache::vhost::base ($content = '', |
2 |
$location = '/dev/null', |
3 |
$use_ssl = false, |
4 |
$vhost = false, |
5 |
$aliases = {}, |
6 |
$server_aliases = [], |
7 |
$access_logfile = false, |
8 |
$error_logfile = false, |
9 |
$options = [], |
10 |
$enable_public_html = false) { |
11 |
include apache::base |
12 |
$httpd_logdir = '/var/log/httpd' |
13 |
$filename = "$name.conf" |
14 |
|
15 |
if ! $vhost { |
16 |
$real_vhost = $name |
17 |
} else { |
18 |
$real_vhost = $vhost |
19 |
} |
20 |
|
21 |
if ! $access_logfile { |
22 |
$real_access_logfile = "$httpd_logdir/${real_vhost}-access_log" |
23 |
} else { |
24 |
$real_access_logfile = $access_logfile |
25 |
} |
26 |
if ! $error_logfile { |
27 |
$real_error_logfile = "$httpd_logdir/${real_vhost}-error_log" |
28 |
} else { |
29 |
$real_error_logfile = $error_logfile |
30 |
} |
31 |
|
32 |
if $use_ssl { |
33 |
include apache::mod::ssl |
34 |
if $wildcard_sslcert != true { |
35 |
openssl::self_signed_cert{ $real_vhost: |
36 |
directory => '/etc/ssl/apache/', |
37 |
before => Apache::Config["/etc/httpd/conf/vhosts.d/$filename"], |
38 |
} |
39 |
} |
40 |
} |
41 |
|
42 |
if $enable_public_html { |
43 |
include apache::mod::public_html |
44 |
} |
45 |
|
46 |
apache::config { "/etc/httpd/conf/vhosts.d/$filename": |
47 |
content => template('apache/vhost_base.conf') |
48 |
} |
49 |
} |
50 |
|