Services

The third most important Puppet resource type is the service, a long-running process which either does some continuous kind of work, or waits for requests and then acts on them. For example, on most systems, the sshd process runs all the time and listens for SSH login attempts.

Puppet models services with the service resource type. Service resources look like the following example (you can find this in service.pp in the /vagrant/examples directory. From now on, I'll just give the filename of each example, as they are all in the same directory):

service { 'sshd':
  ensure => running,
  enable => true,
}

The ensure parameter governs whether the service should be running or not. If its value is running then, as you might expect, Puppet will start ...

Get Puppet 4.10 Beginner's Guide Second Edition 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.