diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-30 17:07:06 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-30 17:07:06 -0200 |
commit | e065bca03404c43a6b8e817e906cf7fb8bf6761d (patch) | |
tree | 5bd908eec70c76b46f4cebb1a0b0b323fc3d2271 | |
parent | 6271ac8abcbc5b09ff1c6ed6d33245a2243cd0d9 (diff) | |
download | puppet-user-e065bca03404c43a6b8e817e906cf7fb8bf6761d.tar.gz puppet-user-e065bca03404c43a6b8e817e906cf7fb8bf6761d.tar.bz2 |
Managing user's .ssh folder
-rw-r--r-- | manifests/init.pp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 55a803b..edfc71d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -142,13 +142,32 @@ class user { # http://projects.reductivelabs.com/issues/2020 # http://groups.google.com/group/puppet-users/browse_thread/thread/131bc7cdc507e3c8/6b61dbcd0b6a68b5?lnk=raot if $sshkey != 'absent' { + file { "${real_homedir}/.ssh": + ensure => directory, + owner => $title, + mode => 0700, + } + + case $gid { + 'absent','uid': { + File["${real_homedir}/.ssh"]{ + group => $name, + } + } + default: { + File["${real_homedir}/.ssh"]{ + group => $gid, + } + } + } + ssh_authorized_key { "$title": ensure => $ensure, key => $sshkey, user => $title, type => $real_sshkey_type, target => "$real_homedir/.ssh/authorized_keys", - require => User["$title"], + require => [ User["$title"], File["${real_homedir}/.ssh"] ] } } } |