Re: [Puppet Users] groups dependencies at user creation

2012-07-07 Thread Stefan Schulte
On Mon, Jul 02, 2012 at 12:20:40PM -0500, Tim Mooney wrote:
   How to ensure groups dependencies at user creation ?.
 
 If you were just talking about the user's default group, then it would
 be one of the few cases where puppet establishes an ordering relation
 for you automatically.  In other words:
 
user { 'foo':
  gid = 'bar',
}
 
 automatically ensures that group 'bar' is present before user 'foo'.
 
 I don't know if that same thing is true for supplemental groups

It is also true for supplemental groups. You can see puppet creates the
relationship when you run puppet agent / puppet apply in debug mode.

So when I run

# puppet apply -vd --noop  EOF
group { ['foo', 'bar']:ensure = present }
user { 'bob': groups = [ 'foo', 'bar' ], ensure = present }
EOF

I get

debug: /Stage[main]//User[bob]: Autorequiring Group[bar]
debug: /Stage[main]//User[bob]: Autorequiring Group[foo]

-Stefan

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



[Puppet Users] groups dependencies at user creation

2012-07-02 Thread eduardo
 Dears all,

  I'm trying to create new users members of some groups so it's need
to ensure they exist before user creation.

  I have something like :


define updssh::add_user ( $email , $groups  ) {

$username = $title

user { $username:
comment = $email,
home= /home/$username,
shell   = /bin/bash,
password = !!,
groups  = $groups
}

--

  How to ensure groups dependencies at user creation ?.


  I appreciate any help,
   eduardo.

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



Re: [Puppet Users] groups dependencies at user creation

2012-07-02 Thread Tim Mooney

In regard to: [Puppet Users] groups dependencies at user creation, eduardo...:


 I'm trying to create new users members of some groups so it's need
to ensure they exist before user creation.

 I have something like :


define updssh::add_user ( $email , $groups  ) {

   $username = $title

   user { $username:
   comment = $email,
   home= /home/$username,
   shell   = /bin/bash,
   password = !!,
   groups  = $groups
   }

--

 How to ensure groups dependencies at user creation ?.


If you were just talking about the user's default group, then it would
be one of the few cases where puppet establishes an ordering relation
for you automatically.  In other words:

  user { 'foo':
gid = 'bar',
  }

automatically ensures that group 'bar' is present before user 'foo'.

I don't know if that same thing is true for supplemental groups, but if
it's not, I would first try using the - notation to establish ordering,
like this

  Group[$groups] - User[$username]

Does that work for you?

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing  Infrastructure  701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

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