-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Stan,
You could try setting refreshonly to 'true' in the exec, that way it will only run when the /etc/fstab file it is subscribed to changes. However, I don't know if this will work as you're only ensuring the file is present. http://docs.puppetlabs.com/references/latest/type.html#exec Alternatively, you could add disk information in a separate configuration file (say, /etc/snmp/snmpd.conf.disk) that is included by the main configuration using an include directive, like this: include "/etc/snmp/snmpd.conf.disk" And then change your exec resource to output the result to /etc/snmp/snmpd.conf.disk instead. Hope that helps, Bill On 05/30/2013 01:32 PM, Stan wrote: > Hello > > Here is my manifest for snmpd, my problem now is that my manifest > will run every time because my snmpd.conf file changes after the > "exec"!! I want that my manifest run when the snmpd.conf (only > snmpd.conf source and not with exec) file change or when my > /etc/fstab file on the client change and it restart the snmpd > service. > > > I do not know if I'm very clear, but it is not easy to explain it > in English. > > Did you have an idea? > > class snmpd::redhat { package { "net-snmp": ensure => present, } > > file { "/etc/snmp/snmpd.conf": ensure => present, owner => 'root', > group => 'root', mode => 644, source => > "puppet:///modules/snmpd/snmpd.conf", require=> > Package["net-snmp"], notify => Exec["disk-snmp"] # notify => > Service["snmpd"] } > > > file { "/etc/fstab": ensure => present } > > > exec { "disk-snmp": command => "grep -e \"ext[2-4]\" > /etc/fstab|awk '{print \"disk\",'$\2'}' >> /etc/snmp/snmpd.conf", > # subscribe => File["/etc/snmp/snmpd.conf"], subscribe => > File["/etc/fstab"], path => ["/usr/bin", "/bin", "/usr/sbin"], > notify => Service["snmpd"] } > > > service { "snmpd": ensure => running, hasstatus => true, > hasrestart => true, enable => true, require => > File['/etc/snmp/snmpd.conf'] } } > > > my source : snmpd.conf : > > com2sec nagios 192.168.1.1 communaute view tout > included .1 group collecte v1 cacti access collecte "" any noauth > exact tout none none syslocation Unknown (edit > /etc/snmp/snmpd.conf) syscontact Root <root@localhost> (configure > /etc/snmp/snmp.local.conf) pass .1.3.6.1.4.1.4413.4.1 > /usr/bin/ucd5820stat > > > > Is it possible in my snmpd.conf source a solution as : > > com2sec nagios 192.168.1.1 communaute view tout > included .1 group collecte v1 cacti access collecte "" any noauth > exact tout none none syslocation Unknown (edit > /etc/snmp/snmpd.conf) syscontact Root <root@localhost> (configure > /etc/snmp/snmp.local.conf) pass .1.3.6.1.4.1.4413.4.1 > /usr/bin/ucd5820stat *Exec **["disk-snmp"]* > > -- You received this message because you are subscribed to the > Google Groups "Puppet Users" group. To unsubscribe from this group > and stop receiving emails from it, send an email to > puppet-users+unsubscr...@googlegroups.com. To post to this group, > send email to puppet-users@googlegroups.com. Visit this group at > http://groups.google.com/group/puppet-users?hl=en. For more > options, visit https://groups.google.com/groups/opt_out. > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlGnk9QACgkQ5xgg9J6hpUuvZgCfUCe4ymWQW83x8YZOYdR8q7DA Va8AoIL+gF0uF0OXNsv8YDpKfyPDhmXL =z7Jy -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.