Ask Your Question

what does puppet do when a service's status fails?

asked 2014-11-24 11:24:04 -0500

Red Cricket gravatar image

updated 2014-11-24 12:38:14 -0500

I have this in my event log for one of my nodes in the puppet dash board:

Changed (1)
Service[openstack-keystone] (/etc/puppetlabs/puppet/modules/keystone/manifests/init.pp:129)
Property    Message
ensure  ensure changed 'stopped' to 'running'

But how can I see what actually command puppet is using to change the service's state from stopped to running? And how can I change it, if I don't think puppet is doing the correct thing?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-24 16:16:56 -0500

jonn gravatar image

updated 2014-11-24 16:21:50 -0500

The command will depend on the provider that is being used. If you run puppet in debug mode, it'll tell you what commands it is running - e.g. on Centos 7, I get this:

# puppet apply -e ' service { "openstack-keystone": ensure => running } ' -d | grep openstack-keystone
Debug: Executing '/usr/bin/systemctl is-active openstack-keystone'
Debug: Executing '/usr/bin/systemctl start openstack-keystone'

In this case, the provider uses systemctl is-active to figure out whether the service is running, and when it finds that it is not, it tries systemctl start to start it up.

You can override most things by passing attributes to the service resource - this explains how:

For example, you could provide a custom start command via:

service { 'openstack-keystone':
  ensure => running,
  start  => '/path/to/startup/script'
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: 2014-11-24 11:24:04 -0500

Seen: 288 times

Last updated: Nov 24 '14