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 usestopped
option to make sure that the service is not running.enable => true
ensures that the service will autostart after a reboot. Thefalse
option ensures that the service is disabled. Lastly, themanual
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....