Services
Although services are implemented in a number of varied and complicated ways at the operating system level, Puppet does a good job of abstracting away most of this with the service resource and exposing just the two attributes of services which you most commonly need to manage: whether they're running (ensure
) and whether they start at boot time (enable
). We covered the use of these in Chapter 2, Creating your first manifests, and most of the time, you won't need to know any more about service resources.
However, you'll occasionally encounter services which don't play well with Puppet, for a variety of reasons. Sometimes Puppet is unable to detect that the service is already running, and keeps trying to start it. Other times, Puppet may not be able to properly restart the service when a dependent resource changes. There are a few useful attributes for service
resources which can help resolve these problems.
The hasstatus attribute
When a
service
resource has the attribute ensure ...