If you are using Chef-based ServerTemplates, it's strongly recommended that you use the latest RightImages (v5.7 and above). Each RightImage installs RightLink and Chef. The included Chef resources contain a combination of common Chef resources developed by Opscode and several RightScale-specific resources. All of the Chef resources that are included in a RightImage are documented in the Chef Resources reference page. Additionally, you can also leverage Chef resources that are defined in a cookbook, which are called Lightweight Resources and Providers (LWRPs). ServerTemplates published by RightScale contain Chef recipes that leverage Chef resources that are provided by both the RightImage and the referenced cookbook repositories.
Lightweight Resources and Providers (LWRPs) are an easy way to define custom actions or system states that are not included with the base Chef installation. LWRPs allow you to define an abstract interface for the action you require (i.e. the Resource), and then separately write the underlying code to implement the action (the Provider).
The Chef resources that are included with the image
A LWRP consists of two components, the resource and the provider.
A LWRP can be defined within a specific cookbook or across multiple cookbooks. For example, since RightScale's 'server_collection' LWRP applies to all servers, its resource and provider files are located within the same cookbook ('rightscale').
However, if you have a generic resource that needs to be executed differently depending on the type of application, system configuration, etc. there may be multiple providers. For example, RightScale's 'app' resource defines generic actions that apply to all applications (e.g. install, start, stop, etc.) while there are different providers that contain the executable code that will perform those actions for several types of applications (e.g. PHP, Tomcat, and Rails Passenger).
If you create your own LWRPs, it's recommended that you follow the example structure outlined below and use a similar naming convention where the resource name (e.g. 'app') is used as a prefix for the different providers (e.g. 'app_tomcat', 'app_php', 'app_passenger').
RightScale provides the following LWRPs, which are made available in our cookbook repositories. In order to successfully use any of the LWRP in your own Chef resources (e.g. recipes), any ServerTemplates that use those scripts must have a RepoPath that includes references to RightScale's 'rightscale_cookbooks' repository. See Create a New RepoPath.
|Resource Name||Related Providers|
Although you have access to many Chef Resources if you are using an instance that's launched with a v5.7 RightImage and above, as well as to existing LWRPs that are available in RightScale's own cookbook repositories (e.g. 'sys_firewall' and 'block_device'), you may want to create your own LWRP to abstract a repeated pattern of behavior that's currently undefined or inaccessible.
To learn how, see Chef Fundamentals: LWRP.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.