Ask Your Question

How to make service to stop before changing the configuration, do configure and bring service up after instead of subscribing on configuration?

asked 2013-09-25 06:48:14 -0600

Cardil gravatar image

updated 2013-09-25 06:49:07 -0600

Is it possible to puppetize the flow described below, instead of standard puppet-way (package -> file ~> service)

  1. stop service, if configuration will be changed
  2. configure service config files
  3. start service

Ad.1: Don't wont to stop service if nothing changed

edit retag flag offensive close merge delete



Could you please clarify why the standard puppet way does not match your need ?

doc75 gravatar imagedoc75 ( 2013-09-25 08:41:36 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-09-25 12:44:12 -0600

Stefan gravatar image

It is not possible through puppet directly but if you really have the need you can of course do something like this:

file { '/etc/':
  ensure => file,
  source => '...',
  notify => Exec['replace_config'],
exec { 'replace_config':
  command     => '/etc/'
  refreshonly => true,

now your is responsible to stop your service, rename the to my_service.conf and then start the service again. But be aware that manual changes to /etc/my_service.conf won't be detected by puppet anymore.

edit flag offensive delete link more


This is probably the simplest way to achieve your direct goal. Taking a step back, it might be worth examining your workflow.

Ancillas gravatar imageAncillas ( 2013-09-25 13:54:54 -0600 )edit

answered 2013-09-25 07:58:52 -0600

rahul khengare gravatar image

How will you know/predict that configuration files gonna change in puppet manifests run?

You can do that stop the service, configure service files and again start the service at each run. But this start the service unnecessarily.

You may try that like whenever the configuration file changes then restart the service.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-25 06:48:14 -0600

Seen: 2,399 times

Last updated: Sep 25 '13