Commit 1bceb46b authored by varac's avatar varac

add backupninja::generate_sshkey

parent a916b073
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';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment