# Inspired by backupninja::sandbox
+#
+# Escaping dotted notation for sshkey lookup, see
+# https://puppet.com/docs/puppet/5.3/hiera_automatic.html#hiera-dotted-notation
define backup::user(
$ensure = present,
$hosting_domain = $::domain,
- $sshkey = '',
+ $sshkey = hiera("'ssh_authorized_key::${name}.${hosting_domain}'"),
) {
- $real_sshkey = $sshkey ? {
- '' => hiera("ssh_authorized_key::${name}.${hosting_domain}"),
- default => $sshkey,
- }
-
user::manage { $name:
ensure => $ensure,
password => '*',
gid => 'backupninjas',
shell => '/bin/bash',
homedir => "${::backup::params::backupdir_remote}/${name}.${hosting_domain}",
- sshkey => $real_sshkey,
+ sshkey => $sshkey,
}
}