549e982ba3d0f93732c8d66536927f2a7aca8b63
[mirror/dsa-puppet.git] / modules / roles / manifests / debian_mirror.pp
1 class roles::debian_mirror {
2         include roles::archvsync_base
3
4         $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
5         $archive_root = "${mirror_basedir_prefix}debian"
6
7         $vhost_listen = join([
8                 $::hostname ? {
9                         klecker    => '130.89.148.12:80 127.0.0.1:80 [2001:610:1908:b000::148:12]:80 [2001:67c:2564:a119::148:12]:80 [::1]:80',
10                         mirror-isc => '149.20.4.15:80 127.0.0.1:80 [2001:4f8:1:c::15]:80 [::1]:80',
11                         mirror-conova => '217.196.149.232:80 127.0.0.1:80 [2a02:16a8:dc41:100::232]:80 [::1]:80',
12                         default => hiera("roles.debian_mirror.${::hostname}.listen-addresses", 'missing') ? {
13                                 'missing' => '*:80',
14                                 default => join([hiera("roles.debian_mirror.${::hostname}.listen-addresses"), '127.0.0.1:80', '[::1]:80'])
15                         }
16                 },
17                 has_role('bgp') ? {
18                         true => '193.31.7.2:80 [2a02:158:ffff:deb::2]:80',
19                         default => '',
20                 }], ' ')
21         $onion_v4_addr = $::hostname ? {
22                 mirror-bytemark => '5.153.231.45',
23                 klecker    => '130.89.148.12',
24                 mirror-isc => '149.20.4.15',
25                 default    => undef,
26         }
27
28         apache2::site { '010-ftp.debian.org':
29                 site   => 'ftp.debian.org',
30                 content => template('roles/apache-ftp.debian.org.erb'),
31         }
32
33         if has_role('debian_mirror_onion') {
34                 if ! $onion_v4_addr {
35                         fail("Do not have an onion_v4_addr set for $::hostname.")
36                 }
37
38                 onion::service { 'ftp.debian.org':
39                         port => 80,
40                         target_port => 80,
41                         target_address => $onion_v4_addr,
42                 }
43         }
44
45         roles::mirror_health { 'ftp':
46                 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'],
47                 check_service => 'ftp',
48                 url           => 'http://debian.backend.mirrors.debian.org/debian/dists/sid/Release',
49                 health_url    => 'http://debian.backend.mirrors.debian.org/_health',
50         }
51 }