Online Book Reader

Home Category

Managing Infrastructure with Puppet - James Loope [3]

By Root 115 0

nagios_hostextinfo - The Nagios type hostextinfo

nagios_hostgroup - The Nagios type hostgroup

nagios_service - The Nagios type service

nagios_servicedependency - The Nagios type servicedependency

nagios_serviceescalation - The Nagios type serviceescalation

nagios_serviceextinfo - The Nagios type serviceextinfo

nagios_servicegroup - The Nagios type servicegroup

nagios_timeperiod - The Nagios type timeperiod

notify - Sends an arbitrary message to the agent run-t ...

package - Manage packages

resources - This is a metatype that can manage other reso ...

schedule - Defined schedules for Puppet

selboolean - Manages SELinux booleans on systems with SELi ...

selmodule - Manages loading and unloading of SELinux poli ...

service - Manage running services

ssh_authorized_key - Manages SSH authorized keys

sshkey - Installs and manages ssh host keys

stage - A resource type for specifying run stages

tidy - Remove unwanted files based on specific crite ...

user - Manage users

whit - The smallest possible resource type, for when ...

yumrepo - The client-side description of a yum reposito ...

zfs - Manage zfs

zone - Solaris zones

zpool - Manage zpools

We’ll primarily be concerned with the file, exec, cron, user, group, and package types. In addition to these built-in types, a large variety of user-contributed modules add functionality for nearly every commonly used configuration scenario. Documentation of the built-in types can be found on the Puppet Labs documentation site at http://docs.puppetlabs.com/references/2.6.0/type.html.

To get some detail about each of these resource types, you can use puppet describe type. This will output Puppet’s documentation on that particular resource type including parameters and often usage examples as well:

:> puppet describe host

host

====

Installs and manages host entries. For most systems, these

entries will just be in `/etc/hosts`, but some systems (notably OS X)

will have different solutions.

Parameters

----------

- **ensure**

The basic property that the resource should be in. Valid values are

`present`, `absent`.

- **host_aliases**

Any aliases the host might have. Multiple values must be

specified as an array.

- **ip**

The host's IP address, IPv4 or IPv6.

- **name**

The host name.

- **target**

The file in which to store service information. Only used by

those providers that write to disk.

Providers

---------

parsed

* * *

Note


puppet describe type -s will give you a less verbose description. This is useful if you just want to know the correct name of a parameter without having to grep through pages of text.

* * *

You can also use Puppet to make queries to the resource abstraction layer and return the current state of things on a system. This makes reproducing a particular configuration on an existing system easy when there is a supported resource type. The command for this is puppet resource type name. Here is an example query using the host resource:

:> puppet resource host

host { 'example.example.com':

host_aliases => ['example'],

target => '/etc/hosts',

ip => '10.0.1.101',

ensure => 'present'

}

host { 'localhost':

target => '/etc/hosts',

ip => '127.0.0.1',

ensure => 'present'

}

:> puppet resource host example.example.com

host { 'example.example.com':

host_aliases => ['example'],

target => '/etc/hosts',

ip => '10.0.1.101',

ensure => 'present'

}

Resource types are the building blocks of Puppet configurations and most of your time will be spent using them or writing new types to suit your needs. Let’s start with a simple declaration of a package resource.

Files and Packages

This first statement declares that the package ntp should be installed and that the file ntp.conf should be defined with the given contents and permissions at the path /etc/ntp.conf, but only after the package ntp is installed. You can go ahead and test this out (on a test system!) by saving the above text to test.pp and executing puppet apply test.pp. When this manifest is run against a blank system,

Return Main Page Previous Page Next Page

®Online Book Reader