9b538cede1e503e72c376c31e1f9a1dd2a47f6b2
[mirror/dsa-puppet.git] / modules / roles / manifests / ports_mirror.pp
1 class roles::ports_mirror(
2   Boolean $onion_service = false,
3 ) {
4   include roles::archvsync_base
5
6   include apache2
7
8   $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
9   $archive_root = "${mirror_basedir_prefix}debian-ports"
10
11   $vhost_listen = $::hostname ? {
12     klecker    => '130.89.148.14:80 [2001:67c:2564:a119::148:14]:80',
13     mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80',
14     default    => '*:80',
15   }
16
17   apache2::site { '010-ftp.ports.debian.org':
18     site    => 'ftp.ports.debian.org',
19     content => template('roles/apache-ftp.ports.debian.org.erb'),
20   }
21
22   if $onion_service {
23     $onion_v4_addr = $::hostname ? {
24       klecker    => '130.89.148.14',
25       mirror-isc => '149.20.4.15',
26       default    => undef,
27     }
28
29     if ! $onion_v4_addr {
30       fail("Do not have an onion_v4_addr set for $::hostname.")
31     }
32
33     onion::service { 'ftp.ports.debian.org':
34       port           => 80,
35       target_port    => 80,
36       target_address => $onion_v4_addr,
37     }
38   }
39 }