Use define rather than class to make this work properly
[mirror/dsa-puppet.git] / modules / roles / manifests / mirror_health.pp
1 define roles::mirror_health (
2         $check_hosts    = [],
3         $check_service  = '',
4         $url            = '',
5         $check_interval = 60,
6 ) {
7         package { 'python3-requests':
8                 ensure   => installed,
9         }
10
11         # XXX: avoid duplicating this?
12         file { '/usr/local/sbin/mirror-health':
13                 source => 'puppet:///modules/roles/mirror_health/mirror-health',
14                 owner  => 'root',
15                 group  => 'root',
16                 mode   => '0555',
17         }
18
19         file { "/etc/systemd/system/mirror-health-${check_service}.service":
20                 owner   => 'root',
21                 group   => 'root',
22                 mode    => '0444',
23                 content => template('roles/mirror-health.service.erb'),
24                 notify  => Exec['systemctl daemon-reload'],
25         }
26
27         file { "/etc/systemd/system/multi-user.target.wants/mirror-health-${check_service}.service":
28                 ensure => 'link',
29                 target => "../mirror-health-${check_service}.service",
30                 notify => Exec['systemctl daemon-reload'],
31         }
32 }