Providers implement the actions used to manage resources on a system. Where types express the interfaces used to describe resources, providers implement how resources interact with the underlying system. This clear separation between the interface and the implementation allows multiple providers to be specified for each type. The native type
package, for example, has separate providers that can interact with package utilities across a large number of Linux systems, including
In the last chapter, we created a type called
custom_package, along with a list of attributes describing the resource. This type can be used to express packages that Puppet manages, like the following example:
This chapter will demonstrate how to implement multiple providers for our
custom_package type and covers the following:
Because providers manage the system state described by a resource type, you must first retrieve the instance of a type associated with the provider. The
type method can be called on
Puppet::Type to access any instance of either a native or custom type that Puppet knows about.
Many of the examples in this chapter will use irb to interact ...