Hi
I am using puppet to mirror a directory of files, if any of these
change then processes need to be restarted.
class snort {
package {
["snort", "perl-Archive-Tar", "barnyard2",
"perl-libwww-perl", "perl-
Crypt-SSLeay"]:
ensure => present;
} # package
user{
"snort":
managehome => true,
home => ''/home/snort'',
ensure => present;
}
file {
"/home/snort/Rules/raw/":
mode => "640",
owner => snort,
group => snort,
source => ''puppet:///modules/snort/Rules/raw'',
recurse => true,
recurselimit => 1,
backup => false,
ensure => present;
}
}
This mirrors the files fine....
in another class:
class monitor {
class pulledpork ( $master) {
exec {
"/home/snort/bin/pulledpork -nc conf/$master/pp.conf":
cwd => "/home/snort",
subscribe => [File["/home/snort/conf/$master/pp",
"/home/
snort/Rules/raw"] ],
notify => Service["snort.$master"],
user => "snort";
}
}
.......
}
i.e. what I want to do is run pulled pork if its config or any of the
raw rule files change.
What happens is that PP gets run every time:
notice: /Stage[main]/Snort/File[/home/snort/Rules/raw]/checksum:
checksum changed ''{mtime}Fri Dec 10 16:02:04 +1300 2010'' to
''{mtime}
Fri Dec 10 16:05:00 +1300 2010''
info: /Stage[main]/Snort/File[/home/snort/Rules/raw]: Scheduling
refresh of Exec[/home/snort/bin/pulledpork -nc conf/dmzi/pp.conf]
it would seem that each time puppet runs the mtime on the directory is
changed and this triggers an event next time...
How should I work around this? I would rather not enumerate all the
files in the directory...
Thanks, Russell.
--
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.
Stefan Schulte
2010-Dec-13 18:17 UTC
Re: [Puppet Users] monitoring contents of a directory
On Sun, Dec 12, 2010 at 06:47:23PM -0800, russell.fulton wrote:> file { > "/home/snort/Rules/raw/": > mode => "640", > owner => snort, > group => snort, > source => ''puppet:///modules/snort/Rules/raw'', > recurse => true, > recurselimit => 1, > backup => false, > ensure => present;Try to set checksum to md5 or anything that actually checks the content of things. But I dont know if you can specify this on a directory.> class monitor { > > class pulledpork ( $master) { > exec { > "/home/snort/bin/pulledpork -nc conf/$master/pp.conf": > cwd => "/home/snort", > subscribe => [File["/home/snort/conf/$master/pp", "/home/ > snort/Rules/raw"] ], > notify => Service["snort.$master"], > user => "snort"; > }You want to specify refreshonly => true, otherwise it will be executed every run and not only if it is notified. -Stefan -- 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.