Add HTTPS for trystack.openstack.org

Add HTTPS for trystack.openstack.org and incorporate ServerAlias
support into the static-http-and-https and static-https-redirect
vhost templates.

Change-Id: I7c3ab22485689bf22dfe706fa7b0f6777604db25
This commit is contained in:
Jeremy Stanley 2015-10-22 17:38:33 +00:00
parent 9c98a1edcb
commit f80688f0ef
4 changed files with 24 additions and 36 deletions

@ -316,12 +316,18 @@ class openstack_project::static (
# Trystack
::httpd::vhost { 'trystack.openstack.org':
port => 80,
priority => '50',
port => 443, # Is required despite not being used.
docroot => '/opt/trystack',
template => 'openstack_project/trystack.vhost.erb',
priority => '50',
ssl => true,
template => 'openstack_project/static-http-and-https.vhost.erb',
vhost_name => 'trystack.openstack.org',
serveraliases => ['trystack.org', 'www.trystack.org'],
require => Vcsrepo['/opt/trystack'],
require => [
Vcsrepo['/opt/trystack'],
File[$cert_file],
File[$key_file],
],
}
vcsrepo { '/opt/trystack':

@ -4,6 +4,15 @@
<VirtualHost *:80>
ServerName <%= @vhost_name %>
<% if @serveraliases.is_a? Array -%>
# Permanently redirect these ServerAlias entries to ServerName
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%>
<%= " ServerAlias #{@serveraliases}" %>
RewriteEngine On
RewriteCond %{HTTP_HOST} !<%= @vhost_name %>$ [NC]
RewriteRule ^/(.*)$ http://<%= @vhost_name %>/$1 [L,R=301]
<% end -%>
DocumentRoot <%= @docroot %>
<Directory <%= @docroot %>>
Options Indexes FollowSymLinks MultiViews

@ -4,6 +4,11 @@
<VirtualHost *:80>
ServerName <%= @vhost_name %>
<% if @serveraliases.is_a? Array -%>
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%>
<%= " ServerAlias #{@serveraliases}" %>
<% end -%>
RewriteEngine On
RewriteRule ^/(.*) https://<%= @vhost_name %>/$1 [last,redirect=permanent]
LogLevel warn

@ -1,32 +0,0 @@
# ************************************
# Managed by Puppet
# ************************************
NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
ServerName <%= @srvname %>
<% if @serveraliases.is_a? Array -%>
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%>
<%= " ServerAlias #{@serveraliases}" %>
<% end -%>
# NOTE(pabelanger): Rewrite any valid serveraliases to srvname.
RewriteEngine On
RewriteCond %{HTTP_HOST} !<%= @srvname %>$ [NC]
RewriteRule ^/(.*)$ http://<%= @srvname %>/$1 [L,R=301]
DocumentRoot <%= @docroot %>
<Directory <%= @docroot %>>
Options <%= @options %>
AllowOverride None
Order allow,deny
allow from all
Satisfy Any
</Directory>
ErrorLog /var/log/apache2/<%= @name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= @name %>_access.log combined
ServerSignature Off
</VirtualHost>