accidentally just replied to author? again:
so changed everything as suggested, but still no luck. site.pp: --- node /mag-lab04/ inherits mag-lab { include os_common Os_common::Users::Virtualuser <| tag == 'ops' |> realize Os_common::Users::Virtualuser['tjones'] } ...realize works, collector doesnt users.pp: --- class os_common::users ( ) { $users = loadyaml('/etc/puppet/resources/users.yaml') $userids = keys( $users ) @os_common::users::virtualuser { $userids: } } users/virtualuser.pp: --- define os_common::users::virtualuser ( ) { include 'os_common::users' $user = $os_common::users::users[$title] tag $user['tag'] basic::add_user { $title: email => $user['email'], uid => $user['uid'], role => $user['role'], } basic::add_ssh_key { "${title}_laptop": user => $title, type => $user['keytype'], key => $user['key'], } } users.yaml: --- tjones: uid: 4001 email: t...@x.com keytype: ssh-rsa key: ... role: ops tag: ops ...validated the tag function gets the right setting with a notify{$user['tag']: }. Is this perhaps some kind of timing issue were the tags dont exist (defined via the function) before the collector is called? On Tuesday, April 2, 2013 11:16:56 PM UTC+9, jcbollinger wrote: > > > > On Tuesday, April 2, 2013 3:30:59 AM UTC-5, willia...@meltwater.com wrote: >> >> class os_common::users ( ) { >> $users = loadyaml('/etc/puppet/resources/users.yaml') >> >> define virtualuser ( ) { >> tag $users[$title]['tag'] >> >> basic::add_user { $title: >> email => $users[$title]['email'], >> uid => $users[$title]['uid'], >> role => $users[$title]['role'], >> } >> basic::add_ssh_key { "${title}_laptop": >> user => $title, >> type => $users[$title]['keytype'], >> key => $users[$title]['key'], >> } >> } >> } >> >> ..then try to collect: >> >> Os_common::Users::Virtualuser <| tag == 'ops' |> >> >> ...doesnt work. No errors, but nothing gets applied either. realizing the >> resource by title works however, so theres clearly something wrong with the >> tagging. any ideas? >> >> >> > Also, were I writing this, I would avoid the repeated lookup of > $os_common::users::users[$title]. My next iteration would look something > like this: > > define virtualuser ( ) { > include 'os_common::users' > > $user = $os_common::users::users[$title] > > tag $user['tag'] > > basic::add_user { $title: > email => $user['email'], > uid => $user['uid'], > role => $user['role'], > } > basic::add_ssh_key { "${title}_laptop": > user => $title, > type => $user['keytype'], > key => $user['key'], > } > } > > > Beyond that, I would start attacking the problem that I had defined types > in my 'basic' module whose names were verbs. > > John > > -- 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 puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.