aboutsummaryrefslogtreecommitdiff
path: root/manifests/check.pp
blob: 16aba2e08ba54b153d2969ca20fd561f83ef2c35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
define ssl::check(
  $port     = '443',
  $interval = '60',
  $email    = 'root',
  $hour     = '0',
  $minute   = '0',
  $weekday  = '0',
  $file     = false,
  $ensure   = present,
  $base     = '/etc/ssl'
) {
  $ssl_cert_check = "/usr/local/bin/ssl-cert-check -a -q -x ${interval} -e ${email}"

  $command = $file ? {
    false   => "$ssl_cert_check -s ${name} -p ${port}",
    true    => "$ssl_cert_check -c ${base}/certs/${name}.crt",
    default => "$ssl_cert_check -c ${file}",
  }

  cron { "ssl-cert-check-${name}":
    command  => $command,
    user     => root,
    hour     => $hour,
    minute   => $minute,
    weekday  => $weekday,
    ensure   => $ensure,
    require  => File["/usr/local/bin/ssl-cert-check"],
  }
}