Managing services

Puppet resource type service is used to manage services. In Windows, the management capabilities are somewhat limited. However, if we want to make sure that a service always runs or always stops, we can use the service type.

Here is how to write this:

service { 'servicename':
ensure =>running,stopped
enable =>true,false,manual
  }

The following points explain the preceding code:

  • First line is the service name in Windows.
  • ensure => running makes sure that the service is running. You can also use stopped option to make sure that the service is not running.
  • enable => true ensures that the service will autostart after a reboot. The false option ensures that the service is disabled. Lastly, the manual option sets the starting of the service ...

Get Learning Puppet for Windows Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.