Ask Your Question

Why is a service controlled by puppet not starting

asked 2015-04-13 16:17:41 -0600

Dimitar gravatar image

updated 2015-04-13 16:18:51 -0600

csharpsteen gravatar image

I have a service defined like this on a CentOS 6.6. This is basically an app running on a tomcat whose script /etc/init.d/myservice controls the tomcat server successfully from a command line. The problem is that puppet is not starting it although ensure is set to running.

 service { 'myservice':
      ensure  => running,
      enable  => true,
      provider  => 'redhat',
      hasstatus   => true,
      hasrestart  => true,
      loglevel  => 'debug'

puppet apply node.pp with --debug produces the following

> Debug: Executing '/bin/rpm --version'
> Debug: Executing '/bin/rpm -ql rpm'
> Debug: Executing '/bin/rpm --version'
> Debug: Executing '/sbin/service
> myservice status' Debug: Executing
> '/sbin/chkconfig myservice'

Why is the service not started?

edit retag flag offensive close merge delete


Can you include the rest of the debug output after that? I assume that you can run "service myservice start" manually and that works correctly?

GregLarkin gravatar imageGregLarkin ( 2015-04-13 23:39:36 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-14 09:49:30 -0600

Dimitar gravatar image

updated 2016-03-28 22:45:29 -0600


There was no more output. Puppet stopped after running the service myservice status and then chkconfig myservice.

This morning, with more sugar provided to my brain I tried with explicitly disabling hasstatus (=false) and this time puppet started correctly myservice. With hasstatus puppet used ps -ef to check if the service is running, whereas originally it relied on the output of /etc/init.d/myservice status to determine if the service is running.

This configuration for the service

service { 'myservice':
      ensure  => running,
      enable  => true,
      provider  => 'redhat',
      hasstatus => false,
      loglevel  => 'debug'

produced this result

Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -ql rpm'
Debug: Executing '/bin/rpm --version'
Debug: Service[myservice](provider=redhat): Executing 'ps -ef' 
Debug: Executing '/sbin/chkconfig myservice' 
Debug: Executing '/sbin/service myservice start' 
Debug: Executing  '/sbin/chkconfig myservice'

Looking at the Puppet service type documentation I realized that myservice status command should return a value > 0 when the service is down. In my case myservice status returns 0 for all the commands.

In the next step I'll correct the status command to return the value puppet expects to determine if myservice is up or down.

In any case thank you for your help!

edit flag offensive delete link more


Glad you figured that out - good job!

GregLarkin gravatar imageGregLarkin ( 2015-04-14 10:36:45 -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

1 follower


Asked: 2015-04-13 16:17:41 -0600

Seen: 2,121 times

Last updated: Mar 28 '16