Opscode

Table Of Contents

About LWRPs

A LWRP is a part of a cookbook that is used to extend Chef in a way that allows custom actions to be defined, and then used in recipes in much the same way as any core Chef resource. A LWRP has two principal components:

  • A lightweight resource that defines a set of actions and attributes
  • A lightweight provider that tells Chef how to handle each action, what to do if certain conditions are met, and so on

Once created, an LWRP becomes a Ruby class within the Chef organization. During each Chef run, Chef will read the lightweight resources from recipes and process them alongside all of the other resources. When it is time to configure the node, Chef will use the corresponding lightweight provider to determine the steps required to bring the system into the desired state.

Where the lightweight resource represents a piece of the system, its current state, and the action that is needed to move it to the desired state, a lightweight provider defines the steps that are required to bring that piece of the system from its current state to the desired state. A LWRP behaves similar to Chef resources and providers:

  • A lightweight resource is a key part of a recipe
  • A lightweight resource defines the actions that can be taken
  • During a Chef run, each lightweight resource is identified, and then associated with a lightweight provider
  • A lightweight provider does the work to complete the action requested by the lightweight resource

Read more about how to create lightweight resources here; learn how to use the lightweight resources available in cookbooks maintained by Opscode by clicking one of the links below.

Opscode-maintained

Custom resources and providers can also be created using the lightweight resource provider (LWRP) DSL. Opscode provides several cookbooks that define some commonly used lightweight resource provider (LWRP). To use the lightweight resources provided by Opscode the cookbook that defines it must also be used. These lightweight resources can be used within recipes to increase automation opportunities.

Cookbook Description
apt The apt cookbook is used to configure APT and APT services, for managing APT repositories and preferences.
aws The aws cookbook is used to manage resources that are running in Amazon Web Services.
bluepill The bluepill cookbook is used to install Blue Pill, and then use it to manage services.
chef_handler The chef_handler cookbook is used to distribute and enable Chef exception and report handlers.
daemontools The daemontools cookbook is used to install and configure daemontools so that it can be used to manage UNIX services.
djbdns The djbdns cookbook is used to install djbdns and use it to configure DNS services.
dmg The dmg cookbook is used to create a DMG package for use with Mac OS X.
dynect The dynect cookbook is used to manage DNS records using the DynECT REST API.
firewall The firewall cookbook is used to manage firewalls and their associated firewall rulesets.
freebsd The freebsd cookbook is used to manage port options for FreeBSD.
gunicorn The gunicorn cookbook is used to install and configure Gunicorn.
homebrew The homebrew cookbook is used to install and configure Homebrew for use as the package manager for Mac OS X.
iis The iis cookbook is used to install and configure Internet Information Services (IIS).
maven The maven cookbook is used to install and configure Apache Maven.
mysql The mysql cookbook is used to install and configure MySQL.
nagios The nagios cookbook is used to install and configure Nagios.
pacman The pacman cookbook is used to install the pacman package manager and configure groups.
php The php cookbook is used to install and configure PHP and PHP modules.
powershell The powershell cookbook is used to install Windows PowerShell.
python The python cookbook is used to install Python, pip, and virtualenv.
rabbitmq The rabbitmq cookbook is used to install and configure RabbitMQ.
riak The riak cookbook is used to install and configure the Riak distributed data store.
samba The samba cookbook is used to install and configure Samba.
sudo The sudo cookbook is used to install Indicates that a bootstrap operation should be executed using sudo. and configure /etc/sudoers.
supervisor The supervisor cookbook is used to install Supervisor and use it to provide resources while configuring services.
transmission The transmission cookbook is used to install and configure the Transmission BitTorrent client.
users The users cookbook is used to create users based on a data bag search.
webpi The webpi cookbook is used to run the Microsoft Web Platform Installer (WebPI).
windows The windows cookbook is used to configure auto run, batch, reboot, enable built-in operating system packages, configure Microsoft Windows packages, reboot machines, and more.
yum The yum cookbook is used to configure yum components and manage repositories and GnuPG keys.
zenoss The zenoss cookbook is used to install and configure Zenoss, and then register nodes as devices.