Jim Nachlin
2011-Aug-15 21:04 UTC
[Puppet Users] trying to resolve group dependency in creating users
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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Aaron Grewell
2011-Aug-15 21:26 UTC
Re: [Puppet Users] trying to resolve group dependency in creating users
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 <jim.nachlin@gawker.com> 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 puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gary Larizza
2011-Aug-15 21:30 UTC
Re: [Puppet Users] trying to resolve group dependency in creating users
On Mon, Aug 15, 2011 at 2:26 PM, Aaron Grewell <aaron.grewell@gmail.com>wrote:> 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 <jim.nachlin@gawker.com>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. >> >There is an implicit relationship between managed users and groups in Puppet. If you''re managing the group ''admin'' and the user ''ringo'' and ringo needs to be a part of the ''admin'' group, Puppet will do the right thing. Having said that - you want the ''gid'' parameter as that will set the default group. ''groups'' is an array of groups for which ringo is a member, but gid is what you want here. Give that a try and see if it works for you. -Gary> >> -Jim >> >> -- >> 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+unsubscribe@googlegroups.com. >> 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 puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Gary Larizza Professional Services Engineer Puppet Labs Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and 23rd in Portland, OR! -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jim N
2011-Aug-15 22:02 UTC
[Puppet Users] Re: trying to resolve group dependency in creating users
Hi and thanks for your response. On Aug 15, 5:30 pm, Gary Larizza <g...@puppetlabs.com> wrote:> There is an implicit relationship between managed users and groups in > Puppet. If you''re managing the group ''admin'' and the user ''ringo'' and ringo > needs to be a part of the ''admin'' group, Puppet will do the right thing.Yet I was getting errors when creating users. Puppet was complaining "Found dependency cycles in the following relationships", and listing my users as depending on the "admin" group.> Having said that - you want the ''gid'' parameter as that will set the default > group. ''groups'' is an array of groups for which ringo is a member, but gid > is what you want here. Give that a try and see if it works for you. >OK, this seems like the ticket, but not sure exactly what you mean. In my "groups" module, should I set the gid explicitly like class groups { group { "admin": ensure => present, gid => 500, } } and then in my users class: class users { user { ''ringo'': ensure => present, uid => ''1506'', gid => 500, shell => ''/bin/bash'', home => ''/home/ringo'', managehome => true, password => ''$6$jomSNhWn $AbuCjrUnLgmq5KfGygIcChHxM9Oxodcgv3ngHpbhJdJ4jzbsWt8Aj8aQI6G3WPqFe.mrG42KbD/'', } } ? The problem there is that I can''t be sure whatever gid I choose won''t be taken on the client machine. (I am moving an existing cluster over to puppet.) Thanks again Jim -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gary Larizza
2011-Aug-15 22:04 UTC
Re: [Puppet Users] Re: trying to resolve group dependency in creating users
On Mon, Aug 15, 2011 at 3:02 PM, Jim N <jim.nachlin@gawker.com> wrote:> Hi and thanks for your response. > > On Aug 15, 5:30 pm, Gary Larizza <g...@puppetlabs.com> wrote: > > > There is an implicit relationship between managed users and groups in > > Puppet. If you''re managing the group ''admin'' and the user ''ringo'' and > ringo > > needs to be a part of the ''admin'' group, Puppet will do the right thing. > > Yet I was getting errors when creating users. Puppet was complaining > "Found dependency cycles in the following relationships", and listing > my users as depending on the "admin" group. > > > Having said that - you want the ''gid'' parameter as that will set the > default > > group. ''groups'' is an array of groups for which ringo is a member, but > gid > > is what you want here. Give that a try and see if it works for you. > > > > OK, this seems like the ticket, but not sure exactly what you mean. > > In my "groups" module, should I set the gid explicitly like > > class groups { > group { "admin": > ensure => present, > gid => 500, > } > } > > and then in my users class: > > > class users { > user { ''ringo'': > ensure => present, > uid => ''1506'', > gid => 500, > shell => ''/bin/bash'', > home => ''/home/ringo'', > managehome => true, > password => ''$6$jomSNhWn > > $AbuCjrUnLgmq5KfGygIcChHxM9Oxodcgv3ngHpbhJdJ4jzbsWt8Aj8aQI6G3WPqFe.mrG42KbD/'', > } > } >You can actually do this: gid => ''admin'', It will do what you want :) -Gary> > ? > > The problem there is that I can''t be sure whatever gid I choose won''t > be taken on the client machine. (I am moving an existing cluster over > to puppet.) > > Thanks again > Jim > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- Gary Larizza Professional Services Engineer Puppet Labs Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and 23rd in Portland, OR! -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.