blob: c5e60427ad52712feef9117666c3b0590ba04e87 (
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
|
define backupninja::generate_sshkey(
$ssh_key_basepath = '/etc/puppet/modules/keys/files/backupkeys',
){
# generate backupninja ssh keypair
$ssh_key_name = "backup_${::hostname}_id_rsa"
$ssh_keys = ssh_keygen("${ssh_key_basepath}/${ssh_key_name}")
$public = split($ssh_keys[1],' ')
$public_type = $public[0]
$public_key = $public[1]
# install ssh keypair on client
file { "/root/.ssh/$ssh_key_name":
content => $ssh_keys[0],
owner => root,
group => 0,
mode => '0600';
}
file { "/root/.ssh/$ssh_key_name.pub":
content => $public_key,
owner => root,
group => 0,
mode => '0666';
}
}
|