nm.d.o no longer needs access to projectb on bmdb1
[mirror/dsa-puppet.git] / modules / roles / manifests / debug_mirror.pp
1 # a mirror for debug.debian.org
2 #
3 # @param listen_addr IP addresses to have apache listen on
4 # @param onion_service provide the onion service from this host
5 # @param healthcheck_name name to access this node in the health checker
6 class roles::debug_mirror(
7   Array[Stdlib::IP::Address] $listen_addr = [],
8   Boolean $onion_service = false,
9   Optional[String] $healthcheck_name = undef,
10 ) {
11   include roles::archvsync_base
12   include apache2
13
14   $_enclosed_addresses = empty($listen_addr) ? {
15     true    => ['*'],
16     default => enclose_ipv6($listen_addr),
17   }
18   $vhost_listen = $_enclosed_addresses.map |$a| { "${a}:80" } .join(' ')
19
20   $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
21   $archive_root = "${mirror_basedir_prefix}debian-debug"
22
23   apache2::site { '010-debug.mirrors.debian.org':
24     site    => 'debug.mirrors.debian.org',
25     content => template('roles/apache-debug.mirrors.debian.org.erb'),
26   }
27
28   if $onion_service {
29     $onion_addr = empty($listen_addr) ? {
30       true    => $base::public_address,
31       default => filter_ipv4($listen_addr)[0]
32     }
33     if ! $onion_addr {
34       fail("Do not have a useable address for the onionservice on ${::hostname}.  Is \$listen_addr empty or does it not have an IPv4 address?.")
35     }
36
37     onion::service { 'debug.mirrors.debian.org':
38       port           => 80,
39       target_port    => 80,
40       target_address => $onion_addr,
41     }
42   }
43
44   Ferm::Rule::Simple <<| tag == 'ssh::server::from::ftp_master' |>>
45
46   mirror_health::service { 'debug':
47     this_host_service_name => $healthcheck_name,
48     url                    => 'http://debug.backend.mirrors.debian.org/debian-debug/dists/sid-debug/Release',
49     health_url             => 'http://debug.backend.mirrors.debian.org/_health',
50   }
51 }