A collection of task oriented solutions in Puppet

 

Ensure service is stopped

Challenge

You want to ensure a service is stopped

Solution

class stopped_service {

  service { 'cron':
    ensure => 'stopped',
  }

}

Explanation

There are services that should never be running on your hosts and if they are discovered should be stopped. By setting the ensure service property to stopped (or false) puppet will check for the presence of the service on each run and stop it whenever it finds it running.

This property is often used with service disable to ensure a service is both disabled and does not start on boot.

See also