aboutsummaryrefslogtreecommitdiffstats
path: root/external/sshkeys/manifests/create_key.pp
blob: ff89a8a77cbd48fee701928e1622d6d97621d8ad (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 sshkeys::create_key (
  $ensure = "present",
  $filename = "",
  $force = false,
  $keytype = "rsa",
  $length = 2048,
  $maxdays = "",
  $mindate = ""
) {
  sshkeys::namecheck { "${title}-title": parm => "title", value => $title }

  # apply defaults
  $_filename = $filename ? { "" => "id_${keytype}", default => $filename }
  $_length = $keytype ? { "rsa" => $length, "dsa" => 1024 }

  sshkeys::namecheck { "${title}-filename":
    parm => "filename",
    value => $_filename,
  }

  @sshkeys::setup_key_master { $title:
    ensure  => $ensure,
    force   => $force,
    keytype => $keytype,
    length  => $_length,
    maxdays => $maxdays,
    mindate => $mindate,
  }
}