aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/ssh/create_key.pp
blob: 2d1653831e442249d8f61b46d721e1c8a4b4ef62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Create a ssh key pair
define nodo::subsystem::ssh::create_key(
  $owner,
  $group,
  $keyfile = 'id_rsa',
  $home    = '/home/$owner'
) {
  nodo::subsystem::ssh::folder { "ssh_create_key-${name}":
    home  => $home,
    owner => $owner,
    group => $group,
  }

  exec { "ssh-keygen-${owner}":
    command => "ssh-keygen -t rsa -P '' -f ${home}/.ssh/${keyfile}",
    creates => "${home}/.ssh/${keyfile}",
    user    => $owner,
    group   => $group,
    require => File["${home}/.ssh"],
  }
}