Skip to end of metadata
Go to start of metadata


In Chef, Resources represent a piece of system state and Providers are the underlying implementation which brings them into that state.

(All database vendors support the abstract concept of database creation, but the underlying implementation is different for each.)

Resources are the basic units of work in Chef - a cross platform abstraction of a system's configuration that are declared in Recipes and Definitions, and applied to your nodes. For example, packages may be installed via apt, yum, or the BSD ports and packages systems, but the package resource abstracts these differences away so you can specify that a package should be installed in a cross-platform way. Chef's resources are mostly just containers for data, with some basic validation functionality.


Providers take a resource, compare that resource to the current state of the part of the system it is managing, and then takes the Action specified in the resource.

Providers are the way that Chef supports multiple platforms with a single Resource. Providers are applicable for an individual resource type. For instance, on Red Hat or CentOS, a package resource will use the yum package provider to get the package installed, but on Debian and Ubuntu, the apt package provider will be used. Providers contain most of the intelligence: they're responsible for making Chef idempotent by checking if an action needs to be taken and issuing the commands to the system to take that action.


While typical Resources and Providers are implemented in Chef's core using Ruby classes, implementing Lightweight Resources and Providers (LWRP) is quick and easy, requiring less Ruby knowledge than their heavier counterparts.

(LWRP's also become Ruby classes, but this is done for you, behind the scenes.) LWRPs are loaded from files in a Cookbook's "resources" and "providers" directories; through use of a DSL you can create custom LWRPs for your environment and infrastructure automation.

Opscode LWRP Resources are a set of LWRPs, provided by Opscode, that can be used in Opscode's public open source cookbooks.

These Opscode LWRP Resources are ready made for use within Recipes to increase automation of your environment.







Ohai


Resources



Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.