From: Peter Palfrader Date: Sun, 17 Jan 2016 20:58:58 +0000 (+0100) Subject: http-redir role with apache config X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=7d7ffaa4f9659ff38c0d7542896d9e37618bae5f;p=mirror%2Fdsa-puppet.git http-redir role with apache config --- diff --git a/hieradata/common.yaml b/hieradata/common.yaml index 4bf47ea99..7621a3cc0 100644 --- a/hieradata/common.yaml +++ b/hieradata/common.yaml @@ -44,6 +44,9 @@ roles: - cgi-grnet-01.debian.org git_master: - adayevskaya.debian.org + httpredir: + - httpredir-bm-01.debian.org + - httpredir-csail-01.debian.org jenkins: - jerea.debian.org keyring: diff --git a/modules/roles/files/httpredir/httpredir.debian.org.conf b/modules/roles/files/httpredir/httpredir.debian.org.conf new file mode 100644 index 000000000..fd0d2fcc5 --- /dev/null +++ b/modules/roles/files/httpredir/httpredir.debian.org.conf @@ -0,0 +1,91 @@ +# +#BalancerMember unix:/srv/httpredir.debian.org/sockets/starman|http://127.0.0.2/ +##BalancerMember http://127.0.0.1:5000/ +##BalancerMember http://127.0.0.1:5001/ +##BalancerMember http://127.0.0.1:5002/ +##BalancerMember http://127.0.0.1:5003/ +##BalancerMember http://127.0.0.1:5004/ +##BalancerMember http://127.0.0.1:5005/ +##BalancerMember http://127.0.0.1:5006/ +##BalancerMember http://127.0.0.1:5007/ +##BalancerMember http://127.0.0.1:5008/ +##BalancerMember http://127.0.0.1:5009/ +##BalancerMember http://127.0.0.1:5010/ +# + + + ServerName httpredir.debian.org + ServerAdmin mirrors@debian.org + ServerAlias http.debian.net + ServerAlias http-master.debian.net + ServerAlias amd64-geomirror.debian.net + ServerAlias i386-geomirror.debian.net + ServerAlias sparc-geomirror.debian.net + ServerAlias powerpc-geomirror.debian.net + ServerAlias hurd-i386-geomirror.debian.net + ServerAlias arm-geomirror.debian.net + ServerAlias m68k-geomirror.debian.net + ServerAlias s390-geomirror.debian.net + ServerAlias alpha-geomirror.debian.net + ServerAlias hppa-geomirror.debian.net + ServerAlias ia64-geomirror.debian.net + ServerAlias mips-geomirror.debian.net + ServerAlias mipsel-geomirror.debian.net + ServerAlias http.non-free.org + ServerAlias ftp.non-free.org + ServerAlias mirror.debian.net + ServerAlias *.mirror.debian.net + ServerAlias cdn.debian.net + + ErrorLog /var/log/apache2/httpredir.debian.org-error.log + LogLevel warn + #LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" \"%{Host}i\"" combined_host + CustomLog ${APACHE_LOG_DIR}/httpredir.debian.org-access.log privacy + + #LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Location}o\" \"%{Referer}i\" \"%{User-Agent}i\"" combined_redirects + #CustomLog ${APACHE_LOG_DIR}/httpredir.debian.org-access.log combined_redirects + + DocumentRoot /srv/httpredir.debian.org/www + + + Options FollowSymLinks + AllowOverride None + + + Options Indexes FollowSymLinks MultiViews + AllowOverride None + Require all granted + + + Require all granted + + + Require all denied + + + +# +# Order allow,deny +# allow from all +# + + RewriteEngine on + + RewriteCond %{HTTP_HOST} \.non-?free\.org + RewriteRule ^/?debian/(?:dists/[^/]{1,40}|pool)/main/? http://www.non-free.org/ [R=404,L] + RewriteCond %{HTTP_HOST} \.non-?free\.org + RewriteRule ^/?(?:index\.html)?$ http://www.non-free.org/ [R=301,L] + + #ProxyPass /redir-bay9NBKG balancer://httredir-cluster + ProxyPass /redir-bay9NBKG unix:/srv/httpredir.debian.org/sockets/starman|http://127.0.0.2/ + #ProxyPass /redir-bay9NBKG http://127.0.0.1:5000/ + + RewriteRule ^/?(?:(demo)/)?debian-(security|backports)/(.*) /redir-bay9NBKG/?mirror=$2&url=$3&action=$1 [PT] + RewriteRule ^/?(?:(demo)/)?debian-archive/(.*) /redir-bay9NBKG/?mirror=old&url=$2&action=$1 [PT] + RewriteRule ^/?(?:(demo)/)?debian/(.*) /redir-bay9NBKG/?mirror=archive&url=$2&action=$1 [PT] + + # mirror:// method support: + RewriteRule ^/?debian-(security|backports)\.list(?:$|\?(.+)) /redir-bay9NBKG/?mirror=$1.list$2 [QSA,PT] + RewriteRule ^/?debian-archive\.list(?:$|\?(.+)) /redir-bay9NBKG/?mirror=old.list$1 [QSA,PT] + RewriteRule ^/?debian\.list(?:$|\?(.+)) /redir-bay9NBKG/?mirror=archive.list$1 [QSA,PT] + diff --git a/modules/roles/manifests/httpredir.pp b/modules/roles/manifests/httpredir.pp new file mode 100644 index 000000000..d7a482fae --- /dev/null +++ b/modules/roles/manifests/httpredir.pp @@ -0,0 +1,8 @@ +class roles::httpredir { + if $::apache2 { + apache2::site { '010-httpredir.debian.org': + site => 'httpredir.debian.org', + source => 'puppet:///modules/roles/httpredir/httpredir.debian.org.conf', + } + } +} diff --git a/modules/roles/manifests/init.pp b/modules/roles/manifests/init.pp index fb46df79a..9bdb11d3c 100644 --- a/modules/roles/manifests/init.pp +++ b/modules/roles/manifests/init.pp @@ -280,4 +280,8 @@ class roles { notify => Service['apache2'], } } + + if has_role('httpredir') { + include roles::httpredir + } }