I just can't seem to get this to work at all. I want to have puppet send a log message that shows up in the reports whenever a file changes. This seems so simple from what I've heard and read, but nothing works at all.
Here is the init.pp file:
# sudo init.pp
# 21 Sep 2011: Changed to test for notification only
class sudo {
package { 'sudo':
ensure => present,
before => File['/etc/sudoers'],
}
file { '/etc/sudoers':
ensure => file,
mode => 440,
owner => root,
group => root,
source => 'puppet:///modules/sudo/sudoers',
replace => false,
audit => content,
}
# exec { "/bin/date":
# cwd => "/tmp",
# subscribe => File['/etc/sudoers'],
# refreshonly => true,
# }
# notify { "sudoers has been changed.":
# refreshonly => true,
# }
}
If I add the exec, nothing happens. If I add the notify, it complains about the refreshonly parameter.
If I remove all of the options for the file except audit, then the file permissions change from 440 to 644.
If I remove replace then puppet overwrites the file.
My test has been:
- Run
puppet agent --test - Change file (
/etc/sudo) - Rerun
puppet agent --test(possibly with atouch site.ppor aservice apache2 reloadfirst)
I have yet to see any messages from audit. I'm running puppet v2.6.3 on Ubuntu Lucid Lynx server 10.04.