From: Peter Palfrader Date: Tue, 17 Sep 2019 08:04:16 +0000 (+0200) Subject: ports/static mirror: if listen_addr are not explicitly set, use the host's public... X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=cbccbd0201f8caf55600b42ac5ef9e59aa8089bd;p=mirror%2Fdsa-puppet.git ports/static mirror: if listen_addr are not explicitly set, use the host's public IPv4 address for onion purposes --- diff --git a/hieradata/nodes/senfter.debian.org.yaml b/hieradata/nodes/senfter.debian.org.yaml index 3b2543615..c495e73b6 100644 --- a/hieradata/nodes/senfter.debian.org.yaml +++ b/hieradata/nodes/senfter.debian.org.yaml @@ -2,4 +2,3 @@ classes: - roles::static_mirror_web roles::static_mirror_web::onion_service: true -roles::static_mirror_web::onion_addr: '5.153.231.4' diff --git a/modules/roles/manifests/ports_mirror.pp b/modules/roles/manifests/ports_mirror.pp index 6b20c01ee..ee313746d 100644 --- a/modules/roles/manifests/ports_mirror.pp +++ b/modules/roles/manifests/ports_mirror.pp @@ -25,7 +25,10 @@ class roles::ports_mirror( } if $onion_service { - $onion_addr = filter_ipv4($listen_addr)[0] + $onion_addr = empty($listen_addr) ? { + true => $base::public_address, + default => filter_ipv4($listen_addr)[0] + } if ! $onion_addr { fail("Do not have a useable address for the onionservice on ${::hostname}. Is \$listen_addr empty or does it not have an IPv4 address?.") } diff --git a/modules/roles/manifests/static_mirror_web.pp b/modules/roles/manifests/static_mirror_web.pp index 72f48157b..58472520d 100644 --- a/modules/roles/manifests/static_mirror_web.pp +++ b/modules/roles/manifests/static_mirror_web.pp @@ -142,7 +142,10 @@ class roles::static_mirror_web( if $onion_service { - $onion_addr = filter_ipv4($listen_addr)[0] + $onion_addr = empty($listen_addr) ? { + true => $base::public_address, + default => filter_ipv4($listen_addr)[0] + } if ! $onion_addr { fail("Do not have a useable address for the onionservice on ${::hostname}. Is \$listen_addr empty or does it not have an IPv4 address?.") }