listen on anycast address with apache on debian mirrors that are in the bgp group
[mirror/dsa-puppet.git] / modules / roles / manifests / debian_mirror.pp
1 class roles::debian_mirror {
2         include roles::archvsync_base
3
4         $vhost_listen = join([
5                 $::hostname ? {
6                         klecker    => '130.89.148.12:80 [2001:610:1908:b000::148:12]:80',
7                         mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80',
8                         mirror-conova => '217.196.149.232:80 [2a02:16a8:dc41:100::232]:80',
9                         default => '*:80',
10                 },
11                 has_role('bgp') ? {
12                         true => '193.31.7.2:80 [2a02:158:ffff:deb::2]:80',
13                         default => '',
14                 }], ' ')
15         $onion_v4_addr = $::hostname ? {
16                 mirror-bytemark => '5.153.231.37',
17                 klecker    => '130.89.148.12',
18                 mirror-isc => '149.20.4.15',
19                 default    => undef,
20         }
21         $archive_root = $::hostname ? {
22                 default    => '/srv/mirrors/debian',
23         }
24
25         apache2::site { '010-ftp.debian.org':
26                 site   => 'ftp.debian.org',
27                 content => template('roles/apache-ftp.debian.org.erb'),
28         }
29
30         if has_role('debian_mirror_onion') {
31                 if ! $onion_v4_addr {
32                         fail("Do not have an onion_v4_addr set for $::hostname.")
33                 }
34
35                 onion::service { 'ftp.debian.org':
36                         port => 80,
37                         target_port => 80,
38                         target_address => $onion_v4_addr,
39                 }
40         }
41 }