Define home directory to allow purging of unmanaged keys
authorJan Dittberner <jan@dittberner.info>
Thu, 13 Apr 2017 12:38:41 +0000 (14:38 +0200)
committerJan Dittberner <jan@dittberner.info>
Thu, 13 Apr 2017 12:38:41 +0000 (14:38 +0200)
sitemodules/profiles/manifests/base.pp

index dcc2cc1..846baed 100644 (file)
@@ -37,27 +37,28 @@ class profiles::base (
   # ensure admin users for this container
   $admins.each |String $username| {
     $user = $users[$username]
+    $osusername = $user['username']
     group { $user['username']:
       ensure => present,
     } ->
-    user { $user['username']:
+    user { $osusername:
       ensure         => present,
       comment        => $user['fullname'],
-      gid            => $user['username'],
+      gid            => $osusername,
       groups         => ['sudo', 'adm'],
       password       => $user['password'],
       uid            => $user['uid'],
+      home           => "/home/${osusername}",
       purge_ssh_keys => true,
     }
     $user['ssh_keys'].each |Hash[String, Data] $keydata| {
-       $osusername = $user['username']
        $keyname    = $keydata['name']
         ssh_authorized_key { "${osusername}@${keyname}":
             ensure  => present,
             user    => $user['username'],
             type    => $keydata['type'],
             key     => $keydata['key'],
-            require => User[$user['username']],
+            require => User[$osusername],
         }
     }
   }