Book Image

Learning Puppet for Windows Server

By : Fuat Ulugay
Book Image

Learning Puppet for Windows Server

By: Fuat Ulugay

Overview of this book

Table of Contents (15 chapters)
Learning Puppet for Windows Server
About the Author
About the Reviewers

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 to manual.

As an example, let's start with disabling the Windows file and print sharing features. You can see the service details in the following screenshot. The service display name is Server and the service name is LanmanServer....