Services
The third most important Puppet resource type is the service: a long-running process that 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. The service
resources look like the following example (you can find this in service.pp
in the /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 the service if it is not running. If you set ensure
to stopped
, Puppet will stop the service if it is running.
Services may also be set to start when the system boots, using the enable
parameter. If enable
is set to true
, the...