Improved apache virtual host configuration
Additional configuration files are now fetched from the puppet file server.
This commit is contained in:
parent
eca8e074e5
commit
63440a18d4
5 changed files with 76 additions and 49 deletions
|
@ -48,14 +48,16 @@ class apache::redhat::server {
|
|||
}
|
||||
|
||||
|
||||
define apache::redhat::site($aliases, $root, $config, $redirect) {
|
||||
define apache::redhat::site($aliases, $root, $redirect) {
|
||||
|
||||
if $name == "default" {
|
||||
$site_fqdn = $fqdn
|
||||
$site_conf = "/etc/httpd/site.http.d/00-${site_fqdn}.conf"
|
||||
$site_confdir = "/etc/httpd/site.http.d/00-${site_fqdn}.d"
|
||||
} else {
|
||||
$site_fqdn = $name
|
||||
$site_conf = "/etc/httpd/site.http.d/10-${site_fqdn}.conf"
|
||||
$site_conf = "/etc/httpd/site.http.d/${site_fqdn}.conf"
|
||||
$site_confdir = "/etc/httpd/site.http.d/${site_fqdn}.d"
|
||||
|
||||
if !$redirect {
|
||||
if $root {
|
||||
|
@ -92,20 +94,27 @@ define apache::redhat::site($aliases, $root, $config, $redirect) {
|
|||
notify => Service["httpd"],
|
||||
}
|
||||
|
||||
if $config {
|
||||
File["${site_conf}"] {
|
||||
source => $config,
|
||||
}
|
||||
}
|
||||
if $redirect {
|
||||
File["${site_conf}"] {
|
||||
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
|
||||
}
|
||||
}
|
||||
if !$config and !$redirect {
|
||||
} else {
|
||||
File["${site_conf}"] {
|
||||
content => template("apache/site.http.conf.erb"),
|
||||
}
|
||||
file { "${site_confdir}":
|
||||
ensure => directory,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
purge => true,
|
||||
force => true,
|
||||
recurse => true,
|
||||
source => [ "puppet:///files/apache/sites/${site_fqdn}",
|
||||
"puppet:///custom/empty", ],
|
||||
before => File["${site_conf}"],
|
||||
notify => Service["httpd"],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -186,7 +195,7 @@ class apache::redhat::sslserver {
|
|||
}
|
||||
|
||||
|
||||
define apache::redhat::sslsite($root, $config, $ssl_cert, $ssl_key, $ssl_chain) {
|
||||
define apache::redhat::sslsite($root, $ssl_cert, $ssl_key, $ssl_chain) {
|
||||
|
||||
if $name == "default" {
|
||||
$site_fqdn = $fqdn
|
||||
|
@ -259,8 +268,12 @@ define apache::redhat::sslsite($root, $config, $ssl_cert, $ssl_key, $ssl_chain)
|
|||
}
|
||||
}
|
||||
|
||||
file { "/etc/httpd/site.https.d/${site_fqdn}.conf":
|
||||
$site_conf = "/etc/httpd/site.https.d/${site_fqdn}.conf"
|
||||
$site_confdir = "/etc/httpd/site.https.d/${site_fqdn}.d"
|
||||
|
||||
file { "${site_conf}":
|
||||
ensure => present,
|
||||
content => template("apache/site.https.conf.erb"),
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
|
@ -269,14 +282,18 @@ define apache::redhat::sslsite($root, $config, $ssl_cert, $ssl_key, $ssl_chain)
|
|||
File["/etc/pki/tls/private/${site_fqdn}.key"], ],
|
||||
}
|
||||
|
||||
if $config {
|
||||
File["/etc/httpd/site.https.d/${site_fqdn}.conf"] {
|
||||
source => $config,
|
||||
}
|
||||
} else {
|
||||
File["/etc/httpd/site.https.d/${site_fqdn}.conf"] {
|
||||
content => template("apache/site.https.conf.erb"),
|
||||
}
|
||||
file { "${site_confdir}":
|
||||
ensure => directory,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
purge => true,
|
||||
force => true,
|
||||
recurse => true,
|
||||
source => [ "puppet:///files/apache/sslsites/${site_fqdn}",
|
||||
"puppet:///custom/empty", ],
|
||||
before => File["${site_conf}"],
|
||||
notify => Service["httpsd"],
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue