Go to main content

Using Puppet to Perform Configuration Management in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

About Declaring Puppet Resources

A resource declaration is an expression that describes the desired state for a resource. The Puppet master then takes these resource declarations and compiles them into a catalog. When Puppet applies that catalog to a target system, it manages every resource that it contains, ensuring that the actual state matches the desired state.

In contrast, when you specify the contents and behavior of a class or a defined type, you define it by using the Puppet language. Defining a class or type makes it available to be declared within a manifest.

Puppet uses the following format for basic resource declarations:

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

    All resource declarations use the following format:

  • resource_type – Is the type of resource that is being declared. The resource_type must be a word that does not include quotation marks.

    The resource_type includes an opening that begins with a curly brace ({).

  • title – Is an identifying string that Puppet uses for identification purposes. Every resource_type must have a title, and the string must be unique, per each resource type. Note that the title does not have to match the name of the resource that you are managing on the node.

    The title is followed by a colon (:).

  • attribute – Describes 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 and 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.

    • A trailing comma.

  • A closing curly bracket (}) must be included at the end of the resource declaration.

Note that you can use any amount of white space in the Puppet language.

For more detailed information, go to Language: Resources.