Remove IP addresses from ports_mirror role and move them to hiera
[mirror/dsa-puppet.git] / modules / roles / manifests / ports_mirror.pp
1 class roles::ports_mirror(
2   String  $vhost_listen = '*:80',
3   Boolean $onion_service = false,
4   Optional[Stdlib::IP::Address] $onion_addr = undef,
5 ) {
6   include roles::archvsync_base
7
8   include apache2
9
10   $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix')
11   $archive_root = "${mirror_basedir_prefix}debian-ports"
12
13   apache2::site { '010-ftp.ports.debian.org':
14     site    => 'ftp.ports.debian.org',
15     content => template('roles/apache-ftp.ports.debian.org.erb'),
16   }
17
18   if $onion_service {
19     if ! $onion_addr {
20       fail("Do not have an onion_addr set for ${::hostname}.")
21     }
22
23     onion::service { 'ftp.ports.debian.org':
24       port           => 80,
25       target_port    => 80,
26       target_address => $onion_addr,
27     }
28   }
29 }