I have this user and group that I need to realize: @user { "policyd": ensure => "present", uid => "103", gid => "103", comment => "Postfix Policy Daemon", home => "/home/policyd", shell => "/bin/bash", } @group { "policyd": ensure => "present", gid => "103", } but how do I make sure the group is created before the user? Only way I can think of is realizing the group in a class that I "require" in the class realizing the user, but that seems silly... -jf -- 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.
On 3/10/2010 8:54 AM, Jan-Frode Myklebust wrote:> I have this user and group that I need to realize: > > @user { "policyd": > ensure => "present", > uid => "103", > gid => "103", > comment => "Postfix Policy Daemon", > home => "/home/policyd", > shell => "/bin/bash", > } > @group { "policyd": > ensure => "present", > gid => "103", > } > > but how do I make sure the group is created before the user? Only way > I can think of is realizing the group in a class that I "require" in > the class realizing the user, but that seems silly...You only have to take care that both the user and the group are realized. Puppet will automatically take care of creating a proper dependency between the two. If your question was actually about how to realize both user and group, I''d recommend you using tags to mark both and then realize based on the tags. Regards, David Schmitt -- dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at Klosterneuburg UID: ATU64260999 FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg -- 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.
Sorry, but it doesn''t seem to be that simple. I just tried to include a class that does: realize ( Group["policyd"], User["policyd"] ) and see on the puppet client: Mar 10 12:00:16 asav puppetd[20247]: Starting Puppet client version 0.25.4 Mar 10 12:00:31 asav puppetd[20247]: (//user::virtual/User[policyd]/ ensure) change from absent to present failed: Could not create user policyd: Execution of ''/usr/sbin/useradd -u 103 -g 103 -d /home/ policyd -c Postfix Policy Daemon -s /bin/bash -M policyd'' returned 6: useradd: unknown group 103 Mar 10 12:00:32 asav puppetd[20247]: (//user::virtual/Group[policyd]/ ensure) created Mar 10 12:00:33 asav puppetd[20247]: Finished catalog run in 6.58 seconds So, it fails to create the user on first run.. but will of course succeed the next time since now the group is created... But how can I force group creation before user creation, when the order listed in realize() obviously doesn''t matter. -jf -- 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.
Add this line to your user definition: require => Group["policyd"] That should work On Wed, Mar 10, 2010 at 12:05 PM, janfrode <janfrode@tanso.net> wrote:> Sorry, but it doesn''t seem to be that simple. I just tried to include > a class that does: > > realize ( > Group["policyd"], > User["policyd"] > ) > > and see on the puppet client: > > Mar 10 12:00:16 asav puppetd[20247]: Starting Puppet client version > 0.25.4 > Mar 10 12:00:31 asav puppetd[20247]: (//user::virtual/User[policyd]/ > ensure) change from absent to present failed: Could not create user > policyd: Execution of ''/usr/sbin/useradd -u 103 -g 103 -d /home/ > policyd -c Postfix Policy Daemon -s /bin/bash -M policyd'' returned 6: > useradd: unknown group 103 > Mar 10 12:00:32 asav puppetd[20247]: (//user::virtual/Group[policyd]/ > ensure) created > Mar 10 12:00:33 asav puppetd[20247]: Finished catalog run in 6.58 > seconds > > > So, it fails to create the user on first run.. but will of course > succeed the next time since now the group is created... But how can I > force group creation before user creation, when the order listed in > realize() obviously doesn''t matter. > > > -jf > > -- > 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. > >-- Cheers, Daniel -- 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.
That worked. Great, thanks! -jf -- 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.