101ecaef6e8a869a71b386db3338d67c255126f6
[mirror/dsa-puppet.git] / modules / roles / manifests / historical_mirror.pp
1 # a mirror for archive.debian.org
2 # @param sslname provide rsync via ssl as well
3 class roles::historical_mirror(
4   Optional[String] $sslname = undef,
5 ){
6   include roles::archvsync_base
7   include apache2::expires
8
9   $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
10   $archive_root = "${mirror_basedir_prefix}debian-archive"
11
12   $binds = $::hostname ? {
13     gretchaninov => ['209.87.16.41'   , '[2607:f8f0:614:1::1274:41]'          ],
14     klecker      => ['130.89.148.13'  , '[2001:67c:2564:a119::148:13]'        ],
15     schmelzer    => ['217.196.149.234', '[2a02:16a8:dc41:100::234]'           ],
16     sibelius     => ['193.62.202.28'  , '[2001:630:206:4000:1a1a:0:c13e:ca1c]'],
17     default      => ['[::]'],
18   }
19
20   $onion_v4_addr = $::hostname ? {
21     default => undef,
22   }
23
24   apache2::site { '010-archive.debian.org':
25     site    => 'archive.debian.org',
26     content => template('roles/apache-archive.debian.org.erb'),
27   }
28
29   if $sslname {
30     ssl::service { $sslname:
31       key      => true,
32       tlsaport => [],
33     }
34   }
35
36   rsync::site { 'archive':
37     content     => template('roles/historical_mirror/rsyncd.conf.erb'),
38     max_clients => 100,
39     sslname     => $sslname,
40     binds       => $binds,
41   }
42
43   if has_role('historical_mirror_onion') {
44     if ! $onion_v4_addr {
45       fail("Do not have an onion_v4_addr set for ${::hostname}.")
46     }
47
48     onion::service { 'archive.debian.org':
49       port           => 80,
50       target_port    => 80,
51       target_address => $onion_v4_addr,
52     }
53   }
54
55   Ferm::Rule::Simple <<| tag == 'ssh::server::from::historical_master' |>>
56 }