diff options
-rw-r--r-- | manifests/init.pp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index d050050..4e5f824 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -290,10 +290,23 @@ define sshd::ssh_authorized_key( $target = 'absent', $options = 'absent' ){ + + case $target { + 'absent': { + case $user { + 'root': { $real_target = '/root/.ssh/authorized_keys' } + 'default': { $real_target = "/home/${user}/.ssh/authorized_keys" } + } + } + default: { + $real_target = $target + } + } ssh_authorized_key{$name: type => $type, key => $key, user => $user, + target => $real_target, } case $options { @@ -304,12 +317,4 @@ define sshd::ssh_authorized_key( } } } - case $target { - 'absent': { info("not setting any target for ssh_authorized_key: $name") } - default: { - Ssh_authorized_key[$name]{ - target => $target, - } - } - } } |