Asif Iqbal wrote:
> On Wed, Jul 29, 2009 at 1:57 AM, David Schmitt<da...@dasz.at> wrote:
>> Asif Iqbal wrote:
>>> So I think I should start small and simple and it may grow to a
>>> solution that will be really useful to others.
>>>
>>> Lets start w/ real basic.
>>>
>>> I have 300 hosts. I like a push a user to about 100 hosts (dns
>>> resolver type hosts) out of 300 total.
>>>
>>> How do I set that up within puppet ?
>> The very simplest stuff:
>>
>> | node "dns1", ..., "dns100" {
>> |       user { "foo": ... }
>> | }
> 
> I tried to expand on it and I have setup a recipe which is not really
> working yet
> 
> node basenode {
>      $userlist = [ "user1", "user2", "user3", .. , "user50" ]
>      $passwd = [ "hashkey1", "hashkey2", .. , "hashkey50" ]
>      $fullname = [ "fname1 lname1", "fname2 lname2",... , "fname50 lname50" ]
>      $uids = [ "101", "102", ... , "150" ]
>       user { $userlist:
>               ensure => "present",
>               uid     => $uids,
>               gid => "1",
>               comment => $fullname,
>               home => "/export/home/$userlist",
>               password => $passwd,
>               shell => "/bin/bash",
>               managehome => "true",
>       }
> }

That's not how it is intended to work. You'll need to create a define to 
handle such "parallel" arrays:

define custom_user($passwd, $fullname) {
        user { "user${name}":
                ensure => present,
                uid => 100 + $name,
                gid => 1,
                comment => $fullname,
                home => "/export/home/${name}",
                password => $passwd,
                shell => "/bin/bash",
                managehome => true,
        }
}

custom_user {
        "1":
                passwd => "hashkey1",
                fullname => "fname1 lname1";
        "2":
                passwd => ...
}

See 
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#definitions 
for details on definitions.


Regards, DavidS

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to