Hello,
I am trying to establish an Puppet infrastructure starting with user and 
group management.
For that reason, i created 2 modules: userloader and group. 
Userloader contains a 'function' as template to add users, the module group 
all groups to add.

If the groups are on every system, adding my people within the site.pp 
works well. But I don't want to have every group on every system, they 
should be created dynamically. 

So i tried to add an user with the group "fubar". It failed, because 
"fubar" is not a group on the system. my group module does contain "fubar", 
just without "ensure => present". My config setup:


Thats my "userloader" (often described as user_add):

define userloader ($uid, $gid, $groups, $comment, $password, $sshkeytype, 
> $sshkey) {
>         $user_home = $operatingsystem ? {
>                 Solaris => '/export/home',
>                 SLES => '/home',
>         }
>         $sshkeytypeChecked = $sshkeytype ? {
>                 '' => 'ssh-rsa',
>                 default => $sshkeytype,
>         }
>         $sshkeyChecked = $sshkey ? {
>                 '' => 'notDefined',
>                 default => $sshkey,
>         }
>         user { $title:
>                 uid => $uid,
>                 gid => $gid,
>                 groups => $groups,
>                 comment => $comment,
>                 password => $password,
>                 home => "${user_home}/${title}",
>                 managehome => true,
>                 shell => '/bin/bash',
>                 ensure => present,
>         }
>         ssh_authorized_key { $title:
>                 user => $title,
>                 type => $sshkeytypeChecked,
>                 key => $sshkeyChecked,
>                 name => $comment,
>                 ensure => present,
>         }
> }




Thats my group module with all groups:

class group {
>         ### primary groups
>         group { groupA:
>                 gid => 1000,
>                 ensure => present,
>         }
>         ### secondary groups
>         group { secgroupX:
>                 gid => 1200,
>                 ensure => present,
>         }
>         group { secgroupY:
>                 gid => 1205,
>         }
> }


 

And finally my testuser:

userloader { 'testuser':
>                 uid => 1234,
>                 gid => 1000,
>                 groups => [secgroupX,secgroupY],
>                 comment => 'any name',
>                 password => 'XXXXX',
>                 sshkeytype => 'xxx',
>                 sshkey => 'xxx',
>         }



Could anybody tell me how to add the secgroupY dynamically? (only if it's 
needed)


Thank you,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to