From 514441fa111950f750241e721d02f5fc8573ab00 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 22 Nov 2008 15:12:32 +0000 Subject: rearranged things so that the gid can automatically be set the same as uid --- manifests/defines.pp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/manifests/defines.pp b/manifests/defines.pp index 7dfca45..5c53159 100644 --- a/manifests/defines.pp +++ b/manifests/defines.pp @@ -14,6 +14,10 @@ # Default: true # Note: If you'd like to use unencrypted passwords, you have to set a variable # $password_salt to an 8 character long salt, being used for the password. +# gid: define the gid of the group +# absent: let the system take a gid (*default*) +# uid: take the same as the uid has if it isn't absent +# : take this gid define user::define_user( $name_comment = 'absent', $uid = 'absent', @@ -93,8 +97,23 @@ define user::define_user( case $gid { 'absent': { info("Not defining a gid for user $name") } default: { - User[$name]{ - gid => $gid, + case $gid { + 'uid': { + case $uid { + 'absent': { info("Not defining a gid for user $name as uid is absent") } + default: { + $real_gid = $uid + } + } + } + default: { + $real_gid = $gid + } + } + if $real_gid { + User[$name]{ + gid => $real_gid, + } } } } @@ -162,10 +181,11 @@ define user::define_user( } +# gid: by default it will take the same as the uid define user::sftp_only( $managehome = 'false', $uid = 'absent', - $gid = 'absent', + $gid = 'uid', $homedir_mode = '0750', $password = 'absent', $password_crypted = 'true' -- cgit v1.2.3