1 # base class for Debian's mirror-health checker
2 define mirror_health::service (
5 String $this_host_service_name = $::fqdn,
6 String $check_service = $name,
7 Integer $check_interval = 60,
8 Enum['present','absent'] $ensure = 'present',
12 $service_file = "/etc/systemd/system/mirror-health-${check_service}.service"
15 content => template('mirror_health/mirror-health.service.erb'),
16 notify => [Exec['systemctl daemon-reload'], Service["mirror-health-${check_service}"]],
19 $service_before = $ensure ? {
21 default => [ File[$service_file], ],
23 $service_subscribe = $ensure ? {
24 present => [ File[$service_file], ],
28 $ensure_service = $ensure ? {
32 $ensure_enable = $ensure ? {
36 service { "mirror-health-${check_service}":
37 ensure => $ensure_service,
38 enable => $ensure_enable,
39 require => Exec['systemctl daemon-reload'],
40 before => $service_before,
41 subscribe => $service_subscribe + [ File[ $mirror_health::script ] ],
44 $hosts_file = "${mirror_health::confdir}/${check_service}.hosts"
45 $tag = "mirror_health::service::${check_service}::hosts"
48 ensure_newline => true,
50 notify => Service["mirror-health-${check_service}"],
52 @@concat::fragment { "mirror_health::service::${check_service}::hosts::${this_host_service_name}":
54 target => $hosts_file,
55 content => $this_host_service_name,
57 Concat::Fragment <<| tag == $tag |>>