apache: Combined proxy.http.conf.erb to site.http.conf.erb.

This commit is contained in:
Timo Mkinen 2013-09-24 11:21:29 +03:00
parent 165ec9cbe4
commit 6cebef3715
4 changed files with 38 additions and 47 deletions

View file

@ -88,7 +88,7 @@ class apache::debian::server inherits apache::debian::common {
}
define apache::debian::site($aliases, $root, $redirect) {
define apache::debian::site($aliases, $root, $redirect, $proxy) {
if $name == "default" {
$site_fqdn = $homename
@ -100,7 +100,7 @@ define apache::debian::site($aliases, $root, $redirect) {
$site_confdir = "/etc/apache2/sites-enabled/${site_fqdn}.d"
if !$redirect {
if !$proxy {
if $proxy == "" {
if $root {
file { "/srv/www/http/${site_fqdn}":
ensure => link,
@ -131,8 +131,8 @@ define apache::debian::site($aliases, $root, $redirect) {
file { $site_conf:
ensure => present,
mode => "0644",
owner => root,
group => root,
owner => "root",
group => "root",
notify => Service["apache2"],
}
@ -140,26 +140,24 @@ define apache::debian::site($aliases, $root, $redirect) {
File[$site_conf] {
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
}
} elsif $proxy {
File[$site_conf] {
content => template("apache/proxy.http.conf.erb"),
}
} 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:///modules/custom/empty", ],
before => File[$site_conf],
notify => Service["apache2"],
if $proxy == "" {
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:///modules/custom/empty", ],
before => File[$site_conf],
notify => Service["apache2"],
}
}
}

View file

@ -57,7 +57,7 @@ define apache::redhat::site($aliases, $root, $redirect, $proxy) {
$site_confdir = "/etc/httpd/site.http.d/${site_fqdn}.d"
if !$redirect {
if !$proxy {
if $proxy == "" {
if $root {
file { "/srv/www/http/${site_fqdn}":
ensure => link,
@ -98,26 +98,24 @@ define apache::redhat::site($aliases, $root, $redirect, $proxy) {
File[$site_conf] {
content => "<VirtualHost *:80>\n ServerName ${site_fqdn}\n Redirect permanent / ${redirect}\n</VirtualHost>\n",
}
} elsif $proxy {
File[$site_conf] {
content => template("apache/proxy.http.conf.erb"),
}
} 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:///modules/apache/emptysite", ],
before => File[$site_conf],
notify => Service["httpd"],
if $proxy == "" {
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:///modules/apache/emptysite", ],
before => File[$site_conf],
notify => Service["httpd"],
}
}
}

View file

@ -1,10 +0,0 @@
<VirtualHost *:80>
ServerName <%= @site_fqdn %>
<% if @aliases != "" -%>
ServerAlias <%= @aliases %>
<% end -%>
ErrorLog /srv/www/log/http/<%= @site_fqdn %>/error_log
CustomLog /srv/www/log/http/<%= @site_fqdn %>/access_log combined
ProxyPass / <%= @proxy %>/
ProxyPassReverse / <%= @proxy %>/
</VirtualHost>

View file

@ -5,6 +5,11 @@
<% end -%>
ErrorLog /srv/www/log/http/<%= @site_fqdn %>/error_log
CustomLog /srv/www/log/http/<%= @site_fqdn %>/access_log combined
<% if @proxy != "" -%>
ProxyPass / <%= @proxy %>/
ProxyPassReverse / <%= @proxy %>/
<% else -%>
DocumentRoot /srv/www/http/<%= @site_fqdn %>
Include <%= @site_confdir %>/*.conf
<% end -%>
</VirtualHost>