Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a file that notifies the puppet agent.

In the network module, the proxy settings are included in the .gemrc file like this:

file { "/root/.gemrc":
  content => "http_proxy: $http_proxy\n",
  notify => Service['puppet'],
}

The problem is that puppet stops and does not restart.

Aug 31 12:05:13 snch7log01 puppet-agent[1117]: (/Stage[main]/Network/File[/root/.gemrc]/content) content changed '{md5}2b00042f7481c7b056c4b410d28f33cf' to '{md5}60b725f10c9c85c70d97880dfe8191b3'
Aug 31 12:05:13 snch7log01 puppet-agent[1117]: Caught TERM; calling stop

I assume the code does something like /etc/init.d/puppet stop && /etc/init.d/puppet start Since puppet is not running, it cannot start itself... it kind of makes sense.

How to make puppet restart itself when this file changes? Note that this file may not exist as well.

share|improve this question
I don't really have the answer to your question, but have you investigated running puppet agent from crontab? It could pick up the changes in your file and it wouldn't leave in memory a process which ultimately wakes up at given intervals. – sebastianopilla Aug 31 '12 at 12:51
I thought about creating a crontab which starts puppet if it's down... This might work but I don't think it's the best way to go. – SamK Aug 31 '12 at 12:56

2 Answers

You may need to add to the service resource declaration for 'puppet':

hasrestart => true,
share|improve this answer

In addition to making sure that "hasrestart" is in the manifest, you should also make sure that

"ensure => running"

Is in the manifest. Here is my copy:

class puppet::service {
  service { puppet:
    ensure => running,
    enable  => true,
    hasrestart => true,
    subscribe => File["/etc/puppet/puppet.conf"],
  }     
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.