Ask Your Question

how to start/restart a service twice in a single puppetrun

asked 2014-10-29 02:22:54 -0600

scoopex gravatar image

updated 2014-10-29 02:23:41 -0600

I wrote a puppet module which should perfom the following steps:

  1. download installation archive
  2. install software
  3. start service
  4. connect to service using a client software to perform some configuration/setup tasks
  5. restart service

Step 1-4 relatively simple to implement - but i have no idea how to trigger a start and a restart event in single puppetrun?

Any hints?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-29 07:44:31 -0600

rnelson0 gravatar image

Could steps 3 and 4 be combined into an exec? Install the software, have the exec depend on the install, the exec starts the service/connects/configures, and notifies the service which will cause a restart. Here's what that kind of manifest might look like.

package { 'whatever':
  ensure => latest,
  source => '',
exec{ 'whatever_configuration':
  creates => '/etc/whatever/installed',
  command => 'service whatever start; whatever-config; touch /etc/whatever/installed',
  #alternatively push down an actual script and call that
  notify => Service['whatever'],
service {'whatever':
  ensure => 'running',
  enable => 'true',
  require => Package['whatever'],
edit flag offensive delete link more


Seems to be a solution to workaround this. Thanks - unfortunately puppet does not provide a abstract way to handle recurring restarts.

scoopex gravatar imagescoopex ( 2014-11-01 08:39:59 -0600 )edit

That is true, it does not. However, I am curious why you need to start the service to configure it. Can you not deploy it with a known good config file so that it doesn't need restarted? If it's an application limitation there's only so much you can do, but try to "think puppet" if possible.

rnelson0 gravatar imagernelson0 ( 2014-11-03 07:02:19 -0600 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2014-10-29 02:22:54 -0600

Seen: 816 times

Last updated: Oct 29 '14