Ensure that admin users home directory is created
[cacert-puppet.git] / sitemodules / profiles / manifests / base.pp
index d1d709b..9c09881 100644 (file)
@@ -37,24 +37,29 @@ 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']:
-      ensure   => present,
-      comment  => $user['fullname'],
-      gid      => $user['username'],
-      groups   => ['sudo', 'adm'],
-      password => $user['password'],
-      uid      => $user['uid'],
+    user { $osusername:
+      ensure         => present,
+      comment        => $user['fullname'],
+      gid            => $osusername,
+      groups         => ['sudo', 'adm'],
+      password       => $user['password'],
+      uid            => $user['uid'],
+      home           => "/home/${osusername}",
+      purge_ssh_keys => true,
+      managehome     => true,
     }
     $user['ssh_keys'].each |Hash[String, Data] $keydata| {
-        ssh_authorized_key { "$user['username']@$keydata['name']":
+       $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],
         }
     }
   }