Go to main content

Using Puppet to Perform Configuration Management in Oracle® Solaris 11.4

Exit Print View

Updated: October 2019
 
 

Declaring Puppet Resources

A resource definition specifies the content and behavior of a resource class or type. A resource class or type must be defined before it can be declared within a manifest.

A resource declaration describes the desired state for a resource on the managed system. The Puppet master compiles resource declarations into a catalog for each managed system. Puppet applies each catalog to the corresponding managed system to ensure that the state of that system matches the specified desired state.

Puppet uses the following format for resource declarations:

resource_type { 'title':
  attribute1 => 'value1',
  attribute2 => 'value2',
}
resource_type

The type of resource that is being declared. The resource_type cannot include quotation marks.

title

An identifying string. Every resource_type must have a unique title. The title does not have to match the name of the resource.

attribute

The desired state of the resource. Most resources have a set of required attributes, but they can also include a set of optional attributes.

Attribute/value pairs must consist of the following:

  • An attribute name, which is a lowercase word with no quotes.

    Each attribute name handles some aspect of the resource. Each resource type has its own set of available attributes.

  • An arrow (=>), also called a “fat comma,” or “hash rocket”.

  • A value, which can have any data type.

    The data type of the value depends on what the attribute accepts.

You can use any amount of white space in a resource declaration.

For more detailed information, see Language: Resources.