[Puppet Users] Re: Use the virtual resources and hiera to create the environent specific group os users

2014-05-01 Thread Sans
Thanks guys for the heads up!
I didn't get time to try any of those, which I'll do tonight and report 
back.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3a46375c-b0de-4052-9e87-07ba71586749%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Use the virtual resources and hiera to create the environent specific group os users

2014-04-30 Thread jcbollinger


On Wednesday, April 30, 2014 10:06:18 AM UTC-5, Sans wrote:

 Hi all,

 I have users module, which I don't control but include in my manifest to 
 setup user(s) on my system. This is something I have in one of the .pp 
 files:

 class users::productupport {
 @group { 'productsupport':
 gid = '1553',
 }
 @produser { 'jake_s':
 user= 'jake_s',
 uid = '5001',
 group   = 'productsupport',
 comment = 'Jake Sully',
 .
 }
 @produser { 'nina_g':
 
 }




For that to be much use, there needs somewhere to be a class that declares 
that one and all its siblings.  Maybe it's class 'users':

modules/users/manifests/init.pp:

class users {
  include 'users::idreport'
  include 'users::mondev'
  include 'users::productsupport'
  ...
}

 

 and in my manifest, I realize that information like this: 

 sudoers::snippet {
 'productsupport':
 group   = 'productsupport',
 rights  = ['ALL'];
  }
 Users::Produser | group == productsupport |



 I have four environments and not all  user-group are required on all the 
 environment. How can I do the from hiera? I'm planing to have this in my 
 hiera files:

 *test.yaml:*
 user_group:
   - productsupport
   - mondev

 *stage.yaml:*
 user_group:
   - productsupport
   - idreport



 but then I cannot figure out how I can use user_group to create the group 
 of users. Any help/pointer?
 Just one thing to note: changing anything in the users module not really 
 an option for me but I'm open to any suggestion(s) if it makes thing even 
 better. 



Put your snippet into a defined type, maybe mymodule::group, and use the 
array of group names from hiera to declare the appropriate instances of 
that type.


somewhere.pp:

$my_groups = hiera('user_group')
mymodule::group { $my_groups: }


modules/mymodule/manifests/group.pp:

define mymodule::group {
  include 'users'
  sudoers::snippet { $title:
group = $title,
rights = ['ALL']
  }
  Users::Produser| group == $title |
}


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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a0528009-e0e4-4e7d-8cc8-b6b64e24033f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.