From: Peter Palfrader Date: Sun, 15 Sep 2019 14:30:58 +0000 (+0200) Subject: ports_mirror* -> hiera role; explicitly include apache2 X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=81897130d25eeea37666cf08a46176993c17a3c3;p=mirror%2Fdsa-puppet.git ports_mirror* -> hiera role; explicitly include apache2 --- diff --git a/hieradata/common.yaml b/hieradata/common.yaml index d371eefd8..66f1bbd0e 100644 --- a/hieradata/common.yaml +++ b/hieradata/common.yaml @@ -208,12 +208,6 @@ roles: debug_mirror_onion: - mirror-accumu.debian.org - schmelzer.debian.org - ports_mirror: - - klecker.debian.org - - mirror-isc.debian.org - ports_mirror_onion: - - klecker.debian.org - - mirror-isc.debian.org planet_master: - philp.debian.org planet_search: diff --git a/hieradata/nodes/klecker.debian.org.yaml b/hieradata/nodes/klecker.debian.org.yaml index 1a18dd42a..49bc02e1c 100644 --- a/hieradata/nodes/klecker.debian.org.yaml +++ b/hieradata/nodes/klecker.debian.org.yaml @@ -1,2 +1,6 @@ +--- classes: + - roles::ports_mirror - roles::static_mirror_web + +roles::ports_mirror::onion_service: true diff --git a/hieradata/nodes/mirror-isc.debian.org.yaml b/hieradata/nodes/mirror-isc.debian.org.yaml index 1a18dd42a..49bc02e1c 100644 --- a/hieradata/nodes/mirror-isc.debian.org.yaml +++ b/hieradata/nodes/mirror-isc.debian.org.yaml @@ -1,2 +1,6 @@ +--- classes: + - roles::ports_mirror - roles::static_mirror_web + +roles::ports_mirror::onion_service: true diff --git a/modules/roles/manifests/init.pp b/modules/roles/manifests/init.pp index 25e6bbd6d..438c5a74f 100644 --- a/modules/roles/manifests/init.pp +++ b/modules/roles/manifests/init.pp @@ -181,9 +181,6 @@ class roles { if has_role('ports_master') { include roles::ports_master } - if has_role('ports_mirror') { - include roles::ports_mirror - } if has_role('onionbalance') { include onion::balance diff --git a/modules/roles/manifests/ports_mirror.pp b/modules/roles/manifests/ports_mirror.pp index 323cb3a3c..9b538cede 100644 --- a/modules/roles/manifests/ports_mirror.pp +++ b/modules/roles/manifests/ports_mirror.pp @@ -1,34 +1,39 @@ -class roles::ports_mirror { - include roles::archvsync_base +class roles::ports_mirror( + Boolean $onion_service = false, +) { + include roles::archvsync_base - $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix') - $archive_root = "${mirror_basedir_prefix}debian-ports" + include apache2 - $vhost_listen = $::hostname ? { - klecker => '130.89.148.14:80 [2001:67c:2564:a119::148:14]:80', - mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80', - default => '*:80', - } - $onion_v4_addr = $::hostname ? { - klecker => '130.89.148.14', - mirror-isc => '149.20.4.15', - default => undef, - } + $mirror_basedir_prefix = hiera('role_config__mirrors.mirror_basedir_prefix') + $archive_root = "${mirror_basedir_prefix}debian-ports" - apache2::site { '010-ftp.ports.debian.org': - site => 'ftp.ports.debian.org', - content => template('roles/apache-ftp.ports.debian.org.erb'), - } + $vhost_listen = $::hostname ? { + klecker => '130.89.148.14:80 [2001:67c:2564:a119::148:14]:80', + mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80', + default => '*:80', + } - if has_role('static_mirror_onion') { - if ! $onion_v4_addr { - fail("Do not have an onion_v4_addr set for $::hostname.") - } + apache2::site { '010-ftp.ports.debian.org': + site => 'ftp.ports.debian.org', + content => template('roles/apache-ftp.ports.debian.org.erb'), + } - onion::service { 'ftp.ports.debian.org': - port => 80, - target_port => 80, - target_address => $onion_v4_addr, - } - } + if $onion_service { + $onion_v4_addr = $::hostname ? { + klecker => '130.89.148.14', + mirror-isc => '149.20.4.15', + default => undef, + } + + if ! $onion_v4_addr { + fail("Do not have an onion_v4_addr set for $::hostname.") + } + + onion::service { 'ftp.ports.debian.org': + port => 80, + target_port => 80, + target_address => $onion_v4_addr, + } + } }