aboutsummaryrefslogtreecommitdiff
path: root/manifests/cert.pp
blob: e11281725f3e49d117ffb1e1a2a26dc8ba72ab5b (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
30
define ssl::cert(
  $ensure   = present,
  $owner    = 'root',
  $group    = 'root',
  $pubmode  = '644',
  $privmode = '600',
  $base     = '/etc/ssl',
  $private  = true
) {
  file { "${base}/certs/$name.crt":
    ensure  => $ensure,
    owner   => $owner,
    group   => $group,
    mode    => $pubmode,
    source  => "puppet:///ssl/$name.crt",
    require => File["${base}/certs"],
  }

  if ($private == true) {
    file { "${base}/private/$name.pem":
      ensure  => $ensure,
      owner   => $owner,
      group   => $group,
      mode    => $privmode,
      backup  => false, # Do not backup the private key
      source  => "puppet:///ssl/$name.pem",
      require => File["${base}/private"],
    }
  }
}