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"],
  }
}