I'm using Puppet for a custom system service (GitLab Runner in Docker). I want Puppet to set up and start the service, but I also want to be able to stop and restart it anytime (e.g. through SSH). I read about Puppet's service resource, but it doesn't tell how to control the services or whether it's possible at all.

In case this is not possible in Puppet, what is the best practice regarding this? Writing multiple service configs (e.g. systemd unit file, init.d shell scripts etc.)


Puppet isn't really for ad-hoc stop/start/restart of services - it manages the desired state of a service. So for example

service 'myservice' {
  ensure => 'started'

A puppet agent run with the above configuration will ensure that the myservice service is started - and if it's not then it will start it, otherwise it will do nothing.

What you're looking for sounds more like something like Rundeck

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.