From 50afc033aa1f047992f306544542ec6ca35997e7 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 16 Aug 2017 10:11:19 +1000 Subject: [PATCH] Add mirror01.iad.rax.o.o This is a new Xenial-based mirror in the RAX IAD region Add munging to have a serveralias for numerically named servers Change-Id: I5690e231a53a45e33bd925cd1a4a87ffa025af04 --- hiera/common.yaml | 1 + manifests/site.pp | 3 ++- modules/openstack_project/manifests/mirror.pp | 11 ++++++++++ .../templates/mirror.vhost.erb | 20 +++++++++++++++++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/hiera/common.yaml b/hiera/common.yaml index f486d15a6f..b0a00dfb0c 100644 --- a/hiera/common.yaml +++ b/hiera/common.yaml @@ -443,6 +443,7 @@ cacti_hosts: - mirror.dfw.rax.openstack.org - mirror.gra1.ovh.openstack.org - mirror.iad.rax.openstack.org +- mirror01.iad.rax.openstack.org - mirror.kna1.citycloud.openstack.org - mirror.la1.citycloud.openstack.org - mirror.lon1.citycloud.openstack.org diff --git a/manifests/site.pp b/manifests/site.pp index 4cec9739fc..148e5333ed 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -611,7 +611,8 @@ node 'mirror-update.openstack.org' { # Machines in each region to serve AFS mirrors. # Node-OS: trusty -node /^mirror\..*\.openstack\.org$/ { +# Node-OS: xenial +node /^mirror\d*\..*\.openstack\.org$/ { $group = "mirror" class { 'openstack_project::server': diff --git a/modules/openstack_project/manifests/mirror.pp b/modules/openstack_project/manifests/mirror.pp index 34319464c9..2203de3405 100644 --- a/modules/openstack_project/manifests/mirror.pp +++ b/modules/openstack_project/manifests/mirror.pp @@ -4,6 +4,16 @@ class openstack_project::mirror ( $vhost_name = $::fqdn, ) { + # Some hosts are mirror01, but we need the host to respond to + # "mirror." Re-evaluate this if we end up doing multiple + # mirrors/load balancing etc. + $alias_name = regsubst($vhost_name, 'mirror\d*\.', 'mirror.') + if $alias_name != $vhost_name { + $serveraliases = [$alias_name] + } else { + $serveraliases = undef + } + $mirror_root = '/afs/openstack.org/mirror' $pypi_root = "${mirror_root}/pypi" $wheel_root = "${mirror_root}/wheel" @@ -283,6 +293,7 @@ class openstack_project::mirror ( priority => '50', docroot => "${www_root}", template => 'openstack_project/mirror.vhost.erb', + serveraliases => $serveraliases, require => [ File["${www_root}"], ] diff --git a/modules/openstack_project/templates/mirror.vhost.erb b/modules/openstack_project/templates/mirror.vhost.erb index b661967b62..4c4f61815a 100644 --- a/modules/openstack_project/templates/mirror.vhost.erb +++ b/modules/openstack_project/templates/mirror.vhost.erb @@ -14,10 +14,12 @@ NameVirtualHost <%= @vhost_name %>:8081 :<%= @port %>> ServerName <%= @srvname %> <% if @serveraliases.is_a? Array -%> - <% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> + <% @serveraliases.each do |name| -%> + <%= " ServerAlias #{name}\n" %> + <% end %> <% elsif @serveraliases != nil -%> <%= " ServerAlias #{@serveraliases}" -%> - <% end -%> + <% end %> DocumentRoot <%= @docroot %> > Options <%= @options %> @@ -93,6 +95,13 @@ NameVirtualHost <%= @vhost_name %>:8081 :8080> ServerName <%= @srvname %>:8080 + <% if @serveraliases.is_a? Array -%> + <% @serveraliases.each do |name| -%> + <%= " ServerAlias #{name}:8080\n" %> + <% end %> + <% elsif @serveraliases != nil -%> + <%= " ServerAlias #{@serveraliases}:8080" -%> + <% end %> # Disable directory listing by default. @@ -183,6 +192,13 @@ NameVirtualHost <%= @vhost_name %>:8081 :8081> ServerName <%= @srvname %>:8081 + <% if @serveraliases.is_a? Array -%> + <% @serveraliases.each do |name| -%> + <%= " ServerAlias #{name}:8081\n" %> + <% end %> + <% elsif @serveraliases != nil -%> + <%= " ServerAlias #{@serveraliases}:8081" -%> + <% end %> # Disable directory listing by default.