From e39b5ce77736eca7fed9e6e5b95b9f17663a0534 Mon Sep 17 00:00:00 2001 From: Manuel Desbonnet Date: Fri, 16 May 2014 08:26:08 +0100 Subject: [PATCH] Add serveraliases to cgit vhost template Allow for specifying ServerAlias entries in the apache vhost for the cgit puppet module. (vhost template section lifted from the puppetlabs-apache v0.0.4 vhost-default template). Change-Id: If7c297247b9556458154e4d01a1e0165a25a14b5 --- modules/cgit/manifests/init.pp | 14 ++++++++------ modules/cgit/templates/git.vhost.erb | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/modules/cgit/manifests/init.pp b/modules/cgit/manifests/init.pp index ef16d8f1c0..333f5e73e2 100644 --- a/modules/cgit/manifests/init.pp +++ b/modules/cgit/manifests/init.pp @@ -17,6 +17,7 @@ class cgit( $vhost_name = $::fqdn, $serveradmin = "webmaster@${::fqdn}", + $serveraliases = '', $cgitdir = '/var/www/cgit', $staticfiles = '/var/www/cgit/static', $ssl_cert_file = '', @@ -116,12 +117,13 @@ class cgit( } apache::vhost { $vhost_name: - port => $https_port, - docroot => 'MEANINGLESS ARGUMENT', - priority => '50', - template => 'cgit/git.vhost.erb', - ssl => true, - require => [ + port => $https_port, + serveraliases => $serveraliases, + docroot => 'MEANINGLESS ARGUMENT', + priority => '50', + template => 'cgit/git.vhost.erb', + ssl => true, + require => [ File[$staticfiles], Package['cgit'], ], diff --git a/modules/cgit/templates/git.vhost.erb b/modules/cgit/templates/git.vhost.erb index 6a1a46d9ba..9bda1f842f 100644 --- a/modules/cgit/templates/git.vhost.erb +++ b/modules/cgit/templates/git.vhost.erb @@ -2,6 +2,12 @@ ServerName <%= scope.lookupvar("cgit::vhost_name") %> ServerAdmin <%= scope.lookupvar("cgit::serveradmin") %> +<% if serveraliases.is_a? Array -%> +<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> +<% elsif serveraliases != '' -%> +<%= " ServerAlias #{serveraliases}" -%> +<% end -%> + Alias /cgit-data /usr/share/cgit ScriptAlias /cgit /var/www/cgi-bin/cgit Alias /static <%= scope.lookupvar("cgit::staticfiles") %> @@ -27,6 +33,12 @@ ServerName <%= scope.lookupvar("cgit::vhost_name") %> ServerAdmin <%= scope.lookupvar("cgit::serveradmin") %> +<% if serveraliases.is_a? Array -%> +<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> +<% elsif serveraliases != '' -%> +<%= " ServerAlias #{serveraliases}" -%> +<% end -%> + Alias /cgit-data /usr/share/cgit ScriptAlias /cgit /var/www/cgi-bin/cgit Alias /static <%= scope.lookupvar("cgit::staticfiles") %>