security_mirror -> hiera role; part 2; also make security apache bind to the security...
[mirror/dsa-puppet.git] / modules / roles / manifests / mirror_health.pp
1 define roles::mirror_health (
2         $check_hosts    = [],
3         $check_service  = '',
4         $url            = '',
5         $health_url     = '',
6         $check_interval = 60,
7 ) {
8         ensure_packages(['python3-requests'], { ensure => 'installed' })
9
10 #       if !defined(File['/usr/local/sbin/mirror-health']) {
11 #               file { '/usr/local/sbin/mirror-health':
12 #                       source => 'puppet:///modules/roles/mirror_health/mirror-health',
13 #                       owner  => 'root',
14 #                       group  => 'root',
15 #                       mode   => '0555',
16 #                        notify  => Service["mirror-health-${check_service}"],
17 #                }
18 #        }
19
20         file { "/etc/systemd/system/mirror-health-${check_service}.service":
21                 owner   => 'root',
22                 group   => 'root',
23                 mode    => '0444',
24                 content => template('roles/mirror-health.service.erb'),
25                 notify  => [Exec['systemctl daemon-reload'], Service["mirror-health-${check_service}"]],
26         }
27
28         file { "/etc/systemd/system/multi-user.target.wants/mirror-health-${check_service}.service":
29                 ensure => 'link',
30                 target => "../mirror-health-${check_service}.service",
31                 notify => Exec['systemctl daemon-reload'],
32         }
33
34         service { "mirror-health-${check_service}":
35                 require => Exec['systemctl daemon-reload'],
36                 ensure  => running,
37         }
38 }