Hi, I''ve the following class which- depending on the department - changes the krb5.conf. How could I use notice to only be used if the file gets changed/updated? I don''t see a way to use notice in the file resource directly. class stz_krb5 { notice("/etc/krb5.conf Check host: $::hostname department: $stz_krb5::DEPARTMENT") $SOURCE_FILE="puppet://$puppet_fileserver/files/etc/krb5.conf" $DST_FILE="/etc/krb5.conf" if ( $stz_krb5::DEPARTMENT != ''foo'' ){ if ( $stz_krb5::DEPARTMENT != bla'' ){ file { "krb5.conf": name => $DST_FILE, source => $SOURCE_FILE, mode => 644, } } else { notice("Not updating krb5.conf - this is a bla. host: $::hostname department: $stz_krb5::DEPARTMENT") } } else { notice("Not updating krb5.conf - this is a foo System. host: $::hostname department: $stz_krb5::DEPARTMENT") } } -- 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.
The notify resource here would be perfect _if_ it supported ''refreshonly'' ... which unfortunately it does not. (possibly a good feature request though ...). A work around is to use something that does support refreshonly ... namely ''exec''. file { "/tmp/foo": content => "foo", notify => Exec["asdf"], } exec { "asdf": command => "/bin/echo foo", logoutput => true, refreshonly => true, } This will at least print something to the screen only when the file changes. ken. On Fri, Oct 28, 2011 at 12:31 PM, Ralf Groß <ralf.gross@googlemail.com> wrote:> Hi, > > I''ve the following class which- depending on the department - changes > the krb5.conf. How could I use notice to only be used if the file gets > changed/updated? I don''t see a way to use notice in the file resource > directly. > > > class stz_krb5 { > > notice("/etc/krb5.conf Check host: $::hostname department: > $stz_krb5::DEPARTMENT") > > $SOURCE_FILE="puppet://$puppet_fileserver/files/etc/krb5.conf" > $DST_FILE="/etc/krb5.conf" > > > if ( $stz_krb5::DEPARTMENT != ''foo'' ){ > if ( $stz_krb5::DEPARTMENT != bla'' ){ > file { "krb5.conf": > name => $DST_FILE, > source => $SOURCE_FILE, > mode => 644, > } > } else { > notice("Not updating krb5.conf - this is a > bla. host: $::hostname department: $stz_krb5::DEPARTMENT") > } > } else { > notice("Not updating krb5.conf - this is a foo System. > host: $::hostname department: $stz_krb5::DEPARTMENT") > } > } > > -- > 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.
2011/10/28 Ken Barber <ken@puppetlabs.com>:> The notify resource here would be perfect _if_ it supported > ''refreshonly'' ... which unfortunately it does not. (possibly a good > feature request though ...). > > A work around is to use something that does support refreshonly ... > namely ''exec''. > > file { "/tmp/foo": > content => "foo", > notify => Exec["asdf"], > } > exec { "asdf": > command => "/bin/echo foo", > logoutput => true, > refreshonly => true, > } > > This will at least print something to the screen only when the file changes.Yes, I see the change now in the client''s log file. But I was a bit unclear, I''d like to this in the server''s log. So that I can search this log for changes. Ralf -- 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 could always syslog your reports in your puppetmaster that you receive from your clients? Might be more information then you desire though. Just setup reporting (which you probably want at some stage anyway) and use the ''log'' style report. [master] reports = log [agent] report = true I''ve used up my creative idea quota for today I think :-). ''tis friday after all. ken. On Fri, Oct 28, 2011 at 2:27 PM, Ralf Groß <ralf.gross@googlemail.com> wrote:> 2011/10/28 Ken Barber <ken@puppetlabs.com>: >> The notify resource here would be perfect _if_ it supported >> ''refreshonly'' ... which unfortunately it does not. (possibly a good >> feature request though ...). >> >> A work around is to use something that does support refreshonly ... >> namely ''exec''. >> >> file { "/tmp/foo": >> content => "foo", >> notify => Exec["asdf"], >> } >> exec { "asdf": >> command => "/bin/echo foo", >> logoutput => true, >> refreshonly => true, >> } >> >> This will at least print something to the screen only when the file changes. > > > Yes, I see the change now in the client''s log file. But I was a bit > unclear, I''d like to this in the server''s log. So that I can search > this log for changes. > > Ralf > > -- > 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.