aboutsummaryrefslogtreecommitdiff
path: root/manifests/defines/ssh_create_key.pp
blob: 77d1f006ef3967c86df07f4f51f25a9555e1e412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
define ssh_create_key(
  $owner,
  $group,
  $keyfile = 'id_rsa',
  $home    = '/home/$owner'
) {
  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"],
  }
}