Hi all, I have a little problem when configuring snmp. I have to create the user, and for so I must add a line in : /var/net-snmp/snmpd.conf like: createUser nagios MD5 XXXXXXXXXXXX DES XXXXXXXXXXXXXXXx and tehn restart snmp. I''m doing it like: class snmp { package { "net-snmp": } exec { "snmp-user": command => "echo ''createUser nagios MD5 n4g10scheque DES n4g10scheque'' > /var/net-snmp/snmpd.conf", unless => "/bin/ls /var/net-snmp/snmpd.conf", before => File["/etc/snmp/snmpd.conf"], require => File["/var/net-snmp"], before => Service["snmpd"], timeout => "-1", } file { "/var/net-snmp": ensure => directory, owner => "root", group => "root", mode => "755", } file { "/etc/snmp/snmpd.conf": ensure => present, owner => "root", group => "root", mode => "755", source => "puppet://gridinstall.pic.es/files/etc/snmp/snmpd.conf", require => Package["net-snmp"], } service { "snmpd": ensure => "running", restart => "/etc/init.d/snmpd restart", name => "snmpd", path => "/etc/init.d", pattern => "snmpd", } } But I get spurious errors... and the file is not created... Anyone is doing same thing, could show me its code? Or show my error.... TIA, Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arnau Bria wrote:> Hi all, > > I have a little problem when configuring snmp. > I have to create the user, and for so I must add a line in : > /var/net-snmp/snmpd.conf > like: > createUser nagios MD5 XXXXXXXXXXXX DES XXXXXXXXXXXXXXXx > > and tehn restart snmp. > > I''m doing it like: > > class snmp { > > > package { "net-snmp": } > > exec { "snmp-user": > command => "echo ''createUser nagios MD5 n4g10scheque DES n4g10scheque'' > /var/net-snmp/snmpd.conf", > unless => "/bin/ls /var/net-snmp/snmpd.conf", > before => File["/etc/snmp/snmpd.conf"], > require => File["/var/net-snmp"], > before => Service["snmpd"], > timeout => "-1", > }It''s hard to say for certain, since you didn''t actually post what the errors are, but I see a couple issues here. First, based on the command line you''re using there, I assume that the /var/net-snmp/snmpd.conf should contain that one createUser line, and nothing else. If that''s the case, I''d suggest that you use a file type instead, and either keep the file on the server or just use the content parameter. Second, you say that you want that file to trigger a restart of the service. In order to do that, you should use either the notify or subscribe options. So instead, you might try replacing that exec with a file type something like so: file { "/var/net-snmp/snmpd.conf": ensure => present, owner => "root", group => "root", mode => 0755, contents => ''createUser nagios MD5 n4g10scheque DES n4g10scheque '', notify => Service[snmpd] } -- Frank Sweetser fs at wpi.edu | For every problem, there is a solution that WPI Senior Network Engineer | is simple, elegant, and wrong. - HL Mencken GPG fingerprint = 6174 1257 129E 0D21 D8D4 E8A3 8E39 29E3 E2E8 8CEC --~--~---------~--~----~------------~-------~--~----~ 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 Tue, 03 Feb 2009 07:25:38 -0500 Frank Sweetser wrote:> It''s hard to say for certain, since you didn''t actually post what the > errors are, but I see a couple issues here.Ups, sorry, the error is that the file sometimes is created sometimes not.> First, based on the command line you''re using there, I assume that > the /var/net-snmp/snmpd.conf should contain that one createUser line, > and nothing else. If that''s the case, I''d suggest that you use a > file type instead, and either keep the file on the server or just use > the content parameter.Well, It must contain that line and, after service start, snmp transforms that line in some snmp code that looks like: usmUser 1 3 0x80000000 0x6e00 0x6e616700 NULL .1.3.6.1.6.3.10.1.1.2 0xdf887fa6520a03 .1.3.6.1.6.3.10.1.2.2 0xdf887db6e4fc03 "" engineBoots 1 oldEngineID 0x800007e580a617c806000 So the file changes after first start. If I keep the first line (createUser one), everytime puppet runs will notice that file has changed and will redo this step. If I keep the end-state file, snmp does not work... I''m not sure why not, but only works if I echo createUser line and start service.> Second, you say that you want that file to trigger a restart of the > service. In order to do that, you should use either the notify or > subscribe options.Ok, I assumed that, as it will run only once, before statement could be enough. So, I''ll add a "notify" line.> So instead, you might try replacing that exec with a file type > something like so: > > file { "/var/net-snmp/snmpd.conf": > ensure => present, > owner => "root", > group => "root", > mode => 0755, > contents => ''createUser nagios MD5 n4g10scheque DES n4g10scheque > '', > notify => Service[snmpd] > }Thanks! I''ll test ASAP. Cheers, Aranu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arnau Bria wrote:> On Tue, 03 Feb 2009 07:25:38 -0500 > Frank Sweetser wrote: > > >> It''s hard to say for certain, since you didn''t actually post what the >> errors are, but I see a couple issues here. > > Ups, sorry, the error is that the file sometimes is created sometimes > not. > >> First, based on the command line you''re using there, I assume that >> the /var/net-snmp/snmpd.conf should contain that one createUser line, >> and nothing else. If that''s the case, I''d suggest that you use a >> file type instead, and either keep the file on the server or just use >> the content parameter. > Well, It must contain that line and, after service start, snmp > transforms that line in some snmp code that looks like: > > usmUser 1 3 0x80000000 0x6e00 0x6e616700 NULL .1.3.6.1.6.3.10.1.1.2 0xdf887fa6520a03 .1.3.6.1.6.3.10.1.2.2 0xdf887db6e4fc03 "" > engineBoots 1 > oldEngineID 0x800007e580a617c806000 > > So the file changes after first start. > If I keep the first line (createUser one), everytime puppet runs will > notice that file has changed and will redo this step. > If I keep the end-state file, snmp does not work... I''m not sure why > not, but only works if I echo createUser line and start service.In that case, I''d still suggest that you use a file type, but add in the ''replace => false'' parameter. That way, if the file is not there, puppet will create it with the contents you specify, but if it does already exist or has its contents changed, puppet will leave it alone. -- Frank Sweetser fs at wpi.edu | For every problem, there is a solution that WPI Senior Network Engineer | is simple, elegant, and wrong. - HL Mencken GPG fingerprint = 6174 1257 129E 0D21 D8D4 E8A3 8E39 29E3 E2E8 8CEC --~--~---------~--~----~------------~-------~--~----~ 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 Tue, 03 Feb 2009 09:22:20 -0500 Frank Sweetser wrote:> > So the file changes after first start. > > If I keep the first line (createUser one), everytime puppet runs > > will notice that file has changed and will redo this step. > > If I keep the end-state file, snmp does not work... I''m not sure > > why not, but only works if I echo createUser line and start service. > > In that case, I''d still suggest that you use a file type, but add in > the ''replace => false'' parameter. That way, if the file is not > there, puppet will create it with the contents you specify, but if it > does already exist or has its contents changed, puppet will leave it > alone.Ok, so it will be the same as my unless, but puppet correctly, am I right? Thanks for your replies. Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arnau Bria wrote:> On Tue, 03 Feb 2009 09:22:20 -0500 > Frank Sweetser wrote: > >>> So the file changes after first start. >>> If I keep the first line (createUser one), everytime puppet runs >>> will notice that file has changed and will redo this step. >>> If I keep the end-state file, snmp does not work... I''m not sure >>> why not, but only works if I echo createUser line and start service. >> In that case, I''d still suggest that you use a file type, but add in >> the ''replace => false'' parameter. That way, if the file is not >> there, puppet will create it with the contents you specify, but if it >> does already exist or has its contents changed, puppet will leave it >> alone. > > Ok, so it will be the same as my unless, but puppet correctly, am I > right?It should be, yes. -- Frank Sweetser fs at wpi.edu | For every problem, there is a solution that WPI Senior Network Engineer | is simple, elegant, and wrong. - HL Mencken GPG fingerprint = 6174 1257 129E 0D21 D8D4 E8A3 8E39 29E3 E2E8 8CEC --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---