Ask Your Question
1

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 -0500

Cardil gravatar image

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

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

Comments

1

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

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

2 Answers

Sort by ยป oldest newest most voted
3

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

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/my_service.conf.new':
  ensure => file,
  source => '...',
  notify => Exec['replace_config'],
}
exec { 'replace_config':
  command     => '/etc/replace_config.sh'
  refreshonly => true,
}

now your replace_config.sh is responsible to stop your service, rename the my_service.conf.new 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

Comments

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 -0500 )edit
0

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

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

Stats

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

Seen: 2,267 times

Last updated: Sep 25 '13