Set vhost_listen variables required by apache-www.debian.org template
[mirror/dsa-puppet.git] / modules / roles / manifests / historical_mirror.pp
1 class roles::historical_mirror {
2         include roles::archvsync_base
3         include apache2::expires
4
5         $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
6         $archive_root = "${mirror_basedir_prefix}debian-archive"
7
8         $binds = $::hostname ? {
9                 gretchaninov  => ['209.87.16.41'   , '[2607:f8f0:614:1::1274:41]'          ],
10                 klecker       => ['130.89.148.13'  , '[2001:610:1908:b000::148:13]',
11                                   '[2001:67c:2564:a119::148:13]' ],
12                 mirror-conova => ['217.196.149.234', '[2a02:16a8:dc41:100::234]'           ],
13                 sibelius      => ['193.62.202.28'  , '[2001:630:206:4000:1a1a:0:c13e:ca1c]'],
14                 default       => ['[::]'],
15         }
16
17         $onion_v4_addr = $::hostname ? {
18                 default    => undef,
19         }
20
21         apache2::site { '010-archive.debian.org':
22                 site   => 'archive.debian.org',
23                 content => template('roles/apache-archive.debian.org.erb'),
24         }
25
26         if has_role('historical_master') {
27                 $sslname = 'archive-master.debian.org'
28                 ssl::service { $sslname:
29                         key      => true,
30                         tlsaport => [],
31                 }
32         } else {
33                 $sslname = undef
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 }