http-redir role with apache config
authorPeter Palfrader <peter@palfrader.org>
Sun, 17 Jan 2016 20:58:58 +0000 (21:58 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sun, 17 Jan 2016 20:58:58 +0000 (21:58 +0100)
hieradata/common.yaml
modules/roles/files/httpredir/httpredir.debian.org.conf [new file with mode: 0644]
modules/roles/manifests/httpredir.pp [new file with mode: 0644]
modules/roles/manifests/init.pp

index 4bf47ea..7621a3c 100644 (file)
@@ -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 (file)
index 0000000..fd0d2fc
--- /dev/null
@@ -0,0 +1,91 @@
+#<Proxy balancer://httredir-cluster>
+#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/
+#</Proxy>
+
+<VirtualHost *:80>
+       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
+
+       <Directory />
+               Options FollowSymLinks
+               AllowOverride None
+       </Directory>
+       <Directory /srv/httpredir.debian.org/www/>
+               Options Indexes FollowSymLinks MultiViews
+               AllowOverride None
+               Require all granted
+
+               <Limit GET>
+                   Require all granted
+               </Limit>
+               <Limit PUT POST DELETE>
+                   Require all denied
+               </Limit>
+       </Directory>
+
+#      <Location /redir/>
+#          Order allow,deny
+#          allow from all
+#      </Location>
+
+       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]
+</VirtualHost>
diff --git a/modules/roles/manifests/httpredir.pp b/modules/roles/manifests/httpredir.pp
new file mode 100644 (file)
index 0000000..d7a482f
--- /dev/null
@@ -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',
+               }
+       }
+}
index fb46df7..9bdb11d 100644 (file)
@@ -280,4 +280,8 @@ class roles {
                        notify => Service['apache2'],
                }
        }
+
+       if has_role('httpredir') {
+               include roles::httpredir
+       }
 }