Kenneth Holter
2009-Jan-23 12:35 UTC
[Puppet Users] Notifying a service when config file changes
Hello all. I''m trying to get my servers (syslog clients) to forward syslog-messages to a central syslog server. I''m using the "line" resource type to add the necessary entry to /etc/syslog.conf file, and I need a way to notify the syslog service to restart whenever the config file changes. Currently, this is what I''ve done: *service {syslog: ensure => running, subscribe => Line["rsyslogserver"] } line { "rsyslogserver": file => "/etc/syslog.conf", line => "*.* @server1.example.com", ensure => present notify => Service[syslog] } * I thought that the "notify" line would make sure that the syslog service would restart upon changes to the config file, but apparently it isn''t so. Anyone got any suggestions on how to implement this? Regards, Kenneth Holter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Paul Lathrop
2009-Jan-23 18:47 UTC
[Puppet Users] Re: Notifying a service when config file changes
On Fri, Jan 23, 2009 at 4:35 AM, Kenneth Holter <kenneho.ndu@gmail.com> wrote:> service {syslog: > ensure => running, > subscribe => Line["rsyslogserver"] > } > > line { "rsyslogserver": > file => "/etc/syslog.conf", > line => "*.* @server1.example.com", > ensure => present > notify => Service[syslog] > } > > I thought that the "notify" line would make sure that the syslog service > would restart upon changes to the config file, but apparently it isn''t so. > Anyone got any suggestions on how to implement this?Is "line" a define you''ve gotten from somewhere? I think the community is generally trying to use Augeas for this sort of thing. Myself I''d just push out the file as a file resource. --Paul --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Alban Peignier
2009-Jan-23 21:32 UTC
[Puppet Users] Re: Notifying a service when config file changes
Kenneth Holter wrote:> I thought that the "notify" line would make sure that the syslog service > would restart upon changes to the config file, but apparently it isn''t > so. Anyone got any suggestions on how to implement this?You should check the line definition, the notify parameter can be ignored. In this case, you can refactor your line definition to "propagate" the notify parameter. Something like : define line(..., notify => []) { ... exec { ... notify => $notify } ... } Like Paul said, replacing line by augeas is a good way too :) But you need a recent puppet release. Regards, -- Alban Peignier - alban.peignier@free.fr http://people.tryphon.org/~alban --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---