From a052fbf257fdb9c5e604486f61ed80127a78fc31 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 22 Sep 2019 15:56:45 +0200 Subject: [PATCH] mirror_health: this_host_service_name is now optional --- modules/mirror_health/manifests/service.pp | 29 +++++++++++++++++----- modules/roles/manifests/debug_mirror.pp | 5 ---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/modules/mirror_health/manifests/service.pp b/modules/mirror_health/manifests/service.pp index f0df429cc..fced5182c 100644 --- a/modules/mirror_health/manifests/service.pp +++ b/modules/mirror_health/manifests/service.pp @@ -1,10 +1,25 @@ -# base class for Debian's mirror-health checker +# service instance for Debian's mirror-health checker +# +# for each defined service, a daemon will regularly check if the +# local version of matches the majority version among the +# set of all hosts that define a . +# +# the result of this check is then exposed via +# # @param url URL to check for freshness on each host (normally a Release file) # @param health_url URL to the health marker +# @param this_host_service_name this host's service name for this service. +# Other nodes will connect to this hostname to +# fetch url for checking. +# If this is undef, other hosts will not +# check this host. +# @param check_service name of this service +# @param check_interval how often to check +# @param ensure present or absent define mirror_health::service ( String $url, String $health_url, - String $this_host_service_name = $::fqdn, + Optional[String] $this_host_service_name = undef, String $check_service = $name, Integer $check_interval = 60, Enum['present','absent'] $ensure = 'present', @@ -51,10 +66,12 @@ define mirror_health::service ( mode => '0444', notify => Service["mirror-health-${check_service}"], } - @@concat::fragment { "mirror_health::service::${check_service}::hosts::${this_host_service_name}": - tag => $tag, - target => $hosts_file, - content => $this_host_service_name, + if $this_host_service_name and $ensure == 'present' { + @@concat::fragment { "mirror_health::service::${check_service}::hosts::${this_host_service_name}": + tag => $tag, + target => $hosts_file, + content => $this_host_service_name, + } } Concat::Fragment <<| tag == $tag |>> } diff --git a/modules/roles/manifests/debug_mirror.pp b/modules/roles/manifests/debug_mirror.pp index d618b495e..8f1407d3c 100644 --- a/modules/roles/manifests/debug_mirror.pp +++ b/modules/roles/manifests/debug_mirror.pp @@ -43,12 +43,7 @@ class roles::debug_mirror( Ferm::Rule::Simple <<| tag == 'ssh::server::from::ftp_master' |>> - $healthcheck_ensure = $healthcheck_name == undef ? { - true => 'absent', - default => 'present', - } mirror_health::service { 'debug': - ensure => $healthcheck_ensure, this_host_service_name => $healthcheck_name, url => 'http://debug.backend.mirrors.debian.org/debian-debug/dists/sid-debug/Release', health_url => 'http://debug.backend.mirrors.debian.org/_health', -- 2.20.1