Yes you can just tag them from there:

    accounts::users::accounts:
      sysadmin:
        ensure: present
        home: /home/sysadmin
        managehome: "true"
        shell: /bin/bash
        uid: 4000
        gid: sysadmin
        comment: Systems Admin

tags aren't special in any way - they are just a metaparameter that each
resource in puppet can have -
http://docs.puppetlabs.com/references/latest/metaparameter.html#tag

If you don't want to repeat yourself and can deduce the user team(group)
from the yaml file or something, you can use the third parameter for
create_resource which is just the default parameters. So you would have
something like this:

$tags = {
    tag => 'app1'
}

create_resource(user, $myhash, $tags)


-- 
Nikola

On Thu, May 30, 2013 at 09:51:48AM -0700, przemol wrote:
> This approach requires to keep all the users in *.pp files.
> Currently we keep users in yaml file:
> 
> accounts::users::accounts:
>   sysadmin:
>     ensure: present
>     home: /home/sysadmin
>     managehome: "true"
>     shell: /bin/bash
>     uid: 4000
>     gid: sysadmin
>     comment: Systems Admin
> etc
> and create them using create_resource. Is it possible to use hiera to 
> associate all the users to particular servers ?
> 
> 
> On Thursday, May 30, 2013 4:39:02 PM UTC+1, nikolavp wrote:
> >
> > You can always use tags with virtual resources of some sort. Let's say 
> > that user1 is in group app1,  user2 and user3 are in group app2. You can 
> > "tag" those user accounts with that: 
> >
> >     user{'user1' 
> >         ... 
> >         tag => 'app1', 
> >     } 
> >
> >     user {['user2', 'user3']: 
> >         ... 
> >         tag => 'app2', 
> >     } 
> >
> > now in your hiera configurations or somewhere else(like ENC) you can 
> > specify which user accounts belong to that host by realizing only those 
> > that you need. 
> >
> >     node node10,node20 { 
> >         User<<| tag == 'app1' |>> 
> >     } 
> >
> > I would also introduce a fact that exposes the fact that user accounts 
> > of 'app1' "belong" to a particular host 
> >
> > On Thu, May 30, 2013 at 08:02:34AM -0700, przemol wrote: 
> > > Hello, 
> > > 
> > > we have been using puppet 3 with hiera based config and several (usually 
> > > "typical") environments: 
> > > test 
> > > predev 
> > > dev 
> > > preprod 
> > > prod 
> > > ... 
> > > Basically we apply the puppet config to test, then predev, then dev, etc 
> > > But within each environment we have quite a large number of hosts 
> > > (20/50/100/300/...). 
> > > We would like to "group" them into sort of subgroups. For example "dev" 
> > > hosts 
> > > are for developers from different applications teams: app1, app2, app3, 
> > > appN. 
> > > We need to create accounts (user accounts are just an example - there 
> > are 
> > > other similar tasks) on all servers from dev environments: 
> > > user accounts for dev team app1 don't need to be on all dev servers - 
> > just 
> > > on the following nodes: node10 - node20 
> > > user accounts for dev team app2 should be just on the following nodes: 
> > > node35 - node88 
> > > etc 
> > > (and I can't use any regular expressions to select nodes - the same 
> > servers 
> > > in each group could have quite different FQDN) 
> > > Can you recommend what puppet/hiera feature could I use to group servers 
> > ? 
> > > It would be good if I could use it just on central puppet master server 
> > and 
> > > not need to login to every node 
> > > and assign it locally to a group. 
> > > 
> > > Regards 
> > > 
> > > 
> > > -- 
> > > 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] <javascript:>. 
> > > To post to this group, send email to 
> > > [email protected]<javascript:>. 
> >
> > > Visit this group at http://groups.google.com/group/puppet-users?hl=en. 
> > > For more options, visit https://groups.google.com/groups/opt_out. 
> > > 
> > > 
> >
> 
> -- 
> 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.
> 
> 

-- 
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