whitespace change
[mirror/dsa-puppet.git] / modules / roles / manifests / debug_mirror.pp
1 class roles::debug_mirror {
2   include roles::archvsync_base
3
4   $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
5   $archive_root = "${mirror_basedir_prefix}debian-debug"
6
7   $listen_addresses = hiera('roles.debug_mirror')
8     .dig($::fqdn, 'listen-addresses')
9     .then |$a| { $a + [ '127.0.0.1:80', '[::1]:80' ] }
10     .lest || { ['*:80'] }
11
12   $vhost_listen = join($listen_addresses, ' ')
13   $onion_v4_addr = hiera('roles.debug_mirror', {})
14     .dig($::fqdn, 'onion_v4_address')
15
16   apache2::site { '010-debug.mirrors.debian.org':
17     site    => 'debug.mirrors.debian.org',
18     content => template('roles/apache-debug.mirrors.debian.org.erb'),
19   }
20
21   if has_role('debug_mirror_onion') {
22     if ! $onion_v4_addr {
23       fail("Do not have an onion_v4_addr set for ${::hostname}.")
24     }
25
26     onion::service { 'debug.mirrors.debian.org':
27       port           => 80,
28       target_port    => 80,
29       target_address => $onion_v4_addr,
30     }
31   }
32
33   $hosts_to_check = hiera('roles.debug_mirror', {})
34     .map |$h| { $h[1]['service-hostname'] }
35   roles::mirror_health { 'debug':
36     check_hosts   => $hosts_to_check,
37     check_service => 'debug',
38     url           => 'http://debug.backend.mirrors.debian.org/debian-debug/dists/sid-debug/Release',
39     health_url    => 'http://debug.backend.mirrors.debian.org/_health',
40   }
41
42   Ferm::Rule::Simple <<| tag == 'ssh::server::from::ftp_master' |>>
43 }