Hi Folks, Ive been trying to figure this out on Puppet 2.5.5 but just upgraded to 2.6 I have this in a module to make sure zabbix is installed, configured and running: class zabbix_agentd { user { "zabbix": name => ''zabbix'', ensure => present, comment => "Zabbix Monitoring System", home => "/var/lib/ zabbix", managehome => false, shell => "/sbin/ nologin", uid => "109", } ..... rest of class. This works great on puppet clients that do not have the user zabbix, but on clients that already have zabbix I get error such as err: //zabbix_agentd/User[zabbix]/uid: change from 489 to 109 failed: Could not set uid on user[zabbix]: Execution of ''/usr/sbin/usermod -u 109 zabbix'' returned 8: usermod: user zabbix is currently logged in So it seems that I need some way of testing for user zabbix on the clients, but I can''t figure out how. This seems such a basic and easy thing to do that I surprised that I have not already found the answer. Thanks for any suggestions. Don -- 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.
What about just not setting the uid? It sounds like that''s what you are trying to do. On Jul 22, 2010, at 12:30 PM, Don Harden wrote:> > Hi Folks, > > Ive been trying to figure this out on Puppet 2.5.5 but just upgraded > to 2.6 > > I have this in a module to make sure zabbix is installed, configured > and running: > > class zabbix_agentd > { > user { "zabbix": > name => > ''zabbix'', > ensure => > present, > comment => "Zabbix Monitoring > System", > home => "/var/lib/ > zabbix", > managehome => > false, > shell => "/sbin/ > nologin", > uid => > "109", > } > ..... rest of class. > > > This works great on puppet clients that do not have the user zabbix, > but on clients that already have zabbix I get error such as > > err: //zabbix_agentd/User[zabbix]/uid: change from 489 to 109 failed: > Could not set uid on user[zabbix]: Execution of ''/usr/sbin/usermod -u > 109 zabbix'' returned 8: usermod: user zabbix is currently logged in > > So it seems that I need some way of testing for user zabbix on the > clients, but I can''t figure out how. This seems such a basic and > easy thing to do that I surprised that I have not already found the > answer. > > Thanks for any suggestions. > > Don > > -- > 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.
On Jul 22, 2010, at 3:30 PM, Don Harden wrote:> err: //zabbix_agentd/User[zabbix]/uid: change from 489 to 109 failed: > Could not set uid on user[zabbix]: Execution of ''/usr/sbin/usermod -u > 109 zabbix'' returned 8: usermod: user zabbix is currently logged inIf you want the UID to be the same on every system, then it sounds like it was already created with the “wrong” value on some. You will most likely need to log in to each such system and fix some things by hand anyway. When you change a UID, `usermod` on some systems will fix ownership within a user’s home directory, but if the user owns any files elsewhere, you’ll need to fix them by hand. It can be a big project, but once the UID is fixed, Puppet won’t try to run `usermod` at all. If you don’t care about keeping the UID consistent, then yeah, remove that line as suggested. -- Rob McBroom <http://www.skurfer.com/> The magnitude of a problem does not affect its ownership. -- 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.
> If you don’t care about keeping the UID consistent, then yeah, remove that line as suggested.Thanks for the suggestions. ALthought it might be nice, I don''t really care about keeping the UID consistent, but they should be system UIDs (<500). We have several boxes with zabbix installed via distro rpms and others that are running old distros that do not have up-to-date rpms. For both types I want puppet update to or install an in-house compiled zabbix-agentd package. It seems that fixing the current UIDs by hand would work. I kept thinking of this little problem last night after I submitted the original post. I thought a custom fact might work and came up with this little snippit. # <MODULEPATH>/zabbix_agentd/lib/facter Facter.add(:zabbix_user) do confine :kernel => :linux setcode do %x{grep zabbix /etc/passwd |cut -f1 - d:}.chomp end end Then in the manifest if $zabbix_user != "zabbix" { user { "zabbix": name => ''zabbix'', ..... } } This worked in the tests I ran. Thanks again for your feedback Don -- 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 Jul 23, 2010, at 11:32 AM, Don Harden wrote:> We have several boxes with zabbix installed via distro rpms and others > that are running old distros that do not have up-to-date rpms. For > both types I want puppet update to or install an in-house compiled > zabbix-agentd package. It seems that fixing the current UIDs by hand > would work.In that case, couldn’t you just have the package manage the user? -- Rob McBroom <http://www.skurfer.com/> It''s not that I think guns, drugs, prostitution, swimming, eating and reading should be legal. It''s just that no one on Earth has the authority to make them illegal. -- 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.