Pull list of hosts to health check from hiera
authorTollef Fog Heen <tfheen@err.no>
Thu, 1 Feb 2018 18:51:03 +0000 (19:51 +0100)
committerTollef Fog Heen <tfheen@err.no>
Thu, 1 Feb 2018 19:11:41 +0000 (20:11 +0100)
Instead of hard coding the set of hosts that Fastly checks, put the
information in hiera.

hieradata/common.yaml
modules/roles/manifests/debian_mirror.pp

index a4a54ab..5538e58 100644 (file)
@@ -245,6 +245,7 @@ roles:
           - '130.89.148.12:80'
           - '[2001:610:1908:b000::148:12]:80'
           - '[2001:67c:2564:a119::148:12]:80'
+        fastly-backend: false
     - mirror-bytemark.debian.org:
         service-hostname: bytemark.debian.backend.mirrors.debian.org
         listen-addresses:
@@ -261,10 +262,12 @@ roles:
         listen-addresses:
           - '217.196.149.232:80'
           - '[2a02:16a8:dc41:100::232]:80'
+        fastly-backend: false
     - mirror-isc.debian.org:
         listen-addresses:
           - '149.20.4.15:80'
           - '[2001:4f8:1:c::15]:80'
+        fastly-backend: false
   debian_mirror_onion:
     - klecker.debian.org
     - mirror-bytemark.debian.org
index c3e2ab1..6e563aa 100644 (file)
@@ -37,8 +37,12 @@ class roles::debian_mirror {
                }
        }
 
+       $mirrors = hiera_hash('roles::debian_mirror',[])
+       $fastly_mirrors = $mirrors.filter |$h| { $h[1]['fastly-backend'] }
+       $hosts_to_check = $fastly_mirrors.map | $h| { $h1['service-hostname'] }
+
         roles::mirror_health { 'ftp':
-               check_hosts   => ['accumu.debian.backend.mirrors.debian.org', 'bytemark.debian.backend.mirrors.debian.org', 'conova.debian.backend.mirrors.debian.org', 'skroutz.debian.backend.mirrors.debian.org'],
+               check_hosts   => $hosts_to_check,
                check_service => 'ftp',
                url           => 'http://debian.backend.mirrors.debian.org/debian/dists/sid/Release',
                health_url    => 'http://debian.backend.mirrors.debian.org/_health',