X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Fmanifests%2Fmirror_health.pp;h=d4d0d625e00c66df315b59ce3209add640f262c9;hb=703c296014e23beedfb75c1d45b4ad3f7a56e26a;hp=3b0d149821ce7461fc3ba129a9e6960932cbee32;hpb=1552612184671215e066d620536e0594a2bb4ea5;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/manifests/mirror_health.pp b/modules/roles/manifests/mirror_health.pp index 3b0d14982..d4d0d625e 100644 --- a/modules/roles/manifests/mirror_health.pp +++ b/modules/roles/manifests/mirror_health.pp @@ -1,27 +1,28 @@ -class roles::mirror_health ( +define roles::mirror_health ( $check_hosts = [], $check_service = '', $url = '', + $health_url = '', $check_interval = 60, ) { - package { 'python3-requests': - ensure => installed, - } + ensure_packages(['python3-requests'], { ensure => 'installed' }) - # XXX: avoid duplicating this? - file { '/usr/local/sbin/mirror-health': - source => 'puppet:///modules/roles/mirror_health/mirror-health', - owner => 'root', - group => 'root', - mode => '0555', - } +# if !defined(File['/usr/local/sbin/mirror-health']) { +# file { '/usr/local/sbin/mirror-health': +# source => 'puppet:///modules/roles/mirror_health/mirror-health', +# owner => 'root', +# group => 'root', +# mode => '0555', +# notify => Service["mirror-health-${check_service}"], +# } +# } file { "/etc/systemd/system/mirror-health-${check_service}.service": owner => 'root', group => 'root', mode => '0444', content => template('roles/mirror-health.service.erb'), - notify => Exec['systemctl daemon-reload'], + notify => [Exec['systemctl daemon-reload'], Service["mirror-health-${check_service}"]], } file { "/etc/systemd/system/multi-user.target.wants/mirror-health-${check_service}.service": @@ -29,4 +30,9 @@ class roles::mirror_health ( target => "../mirror-health-${check_service}.service", notify => Exec['systemctl daemon-reload'], } + + service { "mirror-health-${check_service}": + require => Exec['systemctl daemon-reload'], + ensure => running, + } }