Resource types overview
NOTE: This page was generated from the Puppet source code on 2022-02-07 10:05:45 -0800
List of resource types
About resource types
Built-in types and custom types
This is the documentation for Puppet's built-in resource types and providers. Additional resource types are distributed in Puppet modules.
You can find and install modules by browsing the Puppet Forge. See each module's documentation for information on how to use its custom resource types. For more information about creating custom types, see Custom resources.
As of Puppet 6.0, some resource types were removed from Puppet and repackaged as individual modules. These supported type modules are still included in the
puppet-agent
package, so you don't have to download them from the Forge. See the complete list of affected types in the supported type modules section.
Declaring resources
To manage resources on a target system, declare them in Puppet manifests. For more details, see the resources page of the Puppet language reference.
You can also browse and manage resources interactively using the
puppet resource
subcommand; run puppet resource --help
for more information.
Namevars and titles
All types have a special attribute called the namevar. This is the attribute used to uniquely identify a resource on the target system.
Each resource has a specific namevar attribute, which is listed on this page in each resource's reference. If you don't specify a value for the namevar, its value defaults to the resource's title.
Example of a title as a default namevar:
file { '/etc/passwd':
owner => 'root',
group => 'root',
mode => '0644',
}
In this code, /etc/passwd
is the title of the file resource.
The file type's namevar is path
. Because we didn't provide a path
value in
this example, the value defaults to the title, /etc/passwd
.
Example of a namevar:
file { 'passwords':
path => '/etc/passwd',
owner => 'root',
group => 'root',
mode => '0644',
This example is functionally similar to the previous example. Its path
namevar attribute has an explicitly set value separate from the title, so
its name is still /etc/passwd
.
Other Puppet code can refer to this resource as File['/etc/passwd']
to
declare relationships.
Attributes, parameters, properties
The attributes (sometimes called parameters) of a resource determine its
desired state. They either directly modify the system (internally, these are
called "properties") or they affect how the resource behaves (for instance,
adding a search path for exec
resources or controlling directory recursion
on file
resources).
Providers
Providers implement the same resource type on different kinds of systems. They usually do this by calling out to external commands.
Although Puppet automatically selects an appropriate default provider, you
can override the default with the provider
attribute. (For example, package
resources on Red Hat systems default to the yum
provider, but you can specify
provider => gem
to install Ruby libraries with the gem
command.)
Providers often specify binaries that they require. Fully qualified binary paths indicate that the binary must exist at that specific path, and unqualified paths indicate that Puppet searches for the binary using the shell path.
Features
Features are abilities that some providers might not support. Generally, a feature corresponds to some allowed values for a resource attribute.
This is often the case with the ensure
attribute. In most types, Puppet
doesn't create new resources when omitting ensure
but still modifies existing
resources to match specifications in the manifest. However, in some types this
isn't always the case, or additional values provide more granular control. For
example, if a package
provider supports the purgeable
feature, you can
specify ensure => purged
to delete configuration files installed by the
package.
Resource types define the set of features they can use, and providers can declare which features they provide.
Puppet 6.0 type changes
In Puppet 6.0, we removed some of Puppet's built-in types and moved them into individual modules.
Supported type modules in puppet-agent
The following types are included in supported modules on the Forge. However, they are also included in the puppet-agent
package, so you do not have to install them separately. See each module's README for detailed information about that type.
Type modules available on the Forge
Deprecated types
The following types were deprecated with Puppet 6.0.0. They are available in modules, but are not updated. If you need to use them, you must install the modules separately.
interface
(Use the updatedcisco_ios module
instead.router
(Use the updatedcisco_ios module
instead.vlan
(Use the updatedcisco_ios module
instead.
Puppet core types
For a list of core Puppet types, see the core types cheat sheet.