Have you tried including require => Group['admin'] in the user declaration?
I try to perform my Requires at the resource level instead of the class
level if at all possible.

On Mon, Aug 15, 2011 at 2:04 PM, Jim Nachlin <[email protected]> wrote:

> Hi all,
>
> Using Puppet 2.5, I have a class which creates users:
>
> # cat modules/users/manifests/init.pp
>
> class users {
>  user { 'ringo':
>    ensure     => present,
>    uid        => '1506',
>    groups     => ['admin'],
>    shell      => '/bin/bash',
>    home       => '/home/ringo',
>    managehome => true,
>    password =>
>
> '$6$jomSNhWn$AbuCjrUnLgmq5KfGygIcChHxM9Oxodcgv3ngHpbhJdJ4jzbsWt8Aj8aQI6G3WPqFe.mrG42KbD/',
>  }
> }
>
>
> And one that creates the group:
>
>
>
> # cat modules/groups/manifests/init.pp
>
> class groups {
>  group { "admin":
>    ensure => present,
>  }
> }
>
>
> However, the group "admin" needs to be created before the user can be
> part of it.
>
> I have tried adding require => Class['groups'] to the user.  I have
> tried using the "before" syntax.  Also tried adding a statement at the
> top of the users init.pp, requiring groups.
>
> I can not seem to avoid the error:
>
>
> err: //users/User[ringo]/ensure: change from absent to present failed:
> Could not create user ringo: Execution of '/usr/sbin/useradd -u 1506
> -G admin -d /home/ringo -p
>
> $6$jomSNhWn$AbuCjrUnLgmq5KfGygIcChHxM9OxoNczO7gtHqsngHpbhJdJ4jzbsWt8Aj8aQI6G3WPqFe.mrG42KbD/
> -s /bin/bash -m ringo' returned 6: useradd: group 'admin' does not
> exist
>
> Or some version of a "Found dependency cycles in the following
> relationships" type of error.
>
> Any help ensuring that the group dependency is met before users are
> created, would be appreciated.
>
> -Jim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to