1 |
define sshkeys::create_key ( |
2 |
$ensure = "present", |
3 |
$filename = "", |
4 |
$force = false, |
5 |
$keytype = "rsa", |
6 |
$length = 2048, |
7 |
$maxdays = "", |
8 |
$mindate = "" |
9 |
) { |
10 |
sshkeys::namecheck { "${title}-title": parm => "title", value => $title } |
11 |
|
12 |
# apply defaults |
13 |
$_filename = $filename ? { "" => "id_${keytype}", default => $filename } |
14 |
$_length = $keytype ? { "rsa" => $length, "dsa" => 1024 } |
15 |
|
16 |
sshkeys::namecheck { "${title}-filename": |
17 |
parm => "filename", |
18 |
value => $_filename, |
19 |
} |
20 |
|
21 |
@sshkeys::setup_key_master { $title: |
22 |
ensure => $ensure, |
23 |
force => $force, |
24 |
keytype => $keytype, |
25 |
length => $_length, |
26 |
maxdays => $maxdays, |
27 |
mindate => $mindate, |
28 |
} |
29 |
} |