I wonder if the nil value is not being accepted as 'being passed' - can you populate the nil value and try again?
On Fri, May 18, 2012 at 2:41 PM, Dan White <y...@comcast.net> wrote: > > > > ----- Luke Bigum <luke.bi...@lmax.com> wrote: > > On 18/05/12 13:46, Dan White wrote: > > > Ah, Gary ! Just the brain I wish to pick ! :) > > > > > > Thanks for the response. It makes sense. > > > However, if I perceive this properly, it would provide an > All-Or-Nothing implementation of users. > > > > > > I am looking for for a way to have a master list of users in hiera and > then realize/instantiate a group-keyed-subset of the master list on each > node. > > > > > > “Sometimes I think the surest sign that intelligent life exists > elsewhere in the universe is that none of it has tried to contact us.” > > > Bill Waterson (Calvin& Hobbes) > > > > > > > Why not use a define to wrap the virtualised declaration of your users, > > or tried and doesn't work? Theoretically like this: > > > > -------------------- > > define virtualise_user ($name, $uid, ...) { > > @user { $name: > > uid => $uid, > > } > > } > > > > $all_users = hiera_hash('users') > > > > create_resources('virtualise_user', $all_users) > > -------------------- > > > > Closer, but no cigar yet ! > > user.pp: > ------------------------- > define add_user ( $username, $uid, $ingroups, $info ) { > <clip> > } > > define add_virtual_user ( $v_username, $v_uid, $v_ingroups, $v_info ) { > @add_user { "${name}": > username => "${v_username}", > uid => "${v_uid}", > ingroups => "${v_ingroups}", > info => "${v_info}", > } > } > ------------------------- > /etc/puppet/hierdata/common.yaml: > ------------------------- > users: > beast: > v_username : beast > v_uid : 6666 > v_ingroups : > v_info : Let's see if this works > boo: > v_username : boo > v_uid : 6667 > v_ingroups : > v_info : Let's see if this works also > > ------------------------- > > And if I say: > hiera users -c /etc/puppet/hiera.yaml > > I get: > {"beast"=>{"v_info"=>"Let's see if this works", "v_username"=>"beast", > "v_ingroups"=>nil, "v_uid"=>6666}, "boo"=>{"v_info"=>"Let's see if this > works also", "v_username"=>"boo", "v_ingroups"=>nil, "v_uid"=>6667}} > > Which is out of order, but everything is there. That's how hashes are > supposed to work ! > > But when I try to run the catalog with > $the_users = hiera('users') or $the_users = hiera_hash('users') > followed by : > create_resources ( 'add_virtual_user', $the_users ) > I get: > Must pass a parameter or all necessary values at > /etc/puppet/manifests/nodes/puppetmaster-node.pp:15 on node > puppetmaster.foo.org > > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > -- > 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. > > -- Gary Larizza Professional Services Engineer Puppet Labs -- 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.