Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Requirements

Requires Chef 0.7.10 or higher for Lightweight Resource and Provider support. Chef 0.8+ is recommended. While this cookbook can be used in chef-solo mode, to gain the most flexibility, we recommend using chef-client with a Chef Server.

A Rackspace Cloud account is required. The username and API key are used to authenticate with Rackspace Cloud.

Rackspace Credentials

In order to manage Rackspace Cloud components, authentication credentials need to be available to the node. There are a number of ways to handle this, such as node attributes or roles. We recommend storing these in a databag item (Chef 0.8+), and loading them in the recipe where the resources are needed. To do so, make a data bag called rackspace with an item called cloud that has at least the following:

You may choose to provide your rackspace_auth_url and rackspace_auth_region in the data bag item as well, but they can generally be safely provided as attributes.

The values can be loaded in a recipe with:

rackspace = data_bag_item("rackspace", "cloud")

And to access the values:

rackspace['rackspace_username']
rackspace['rackspace_api_key']

The data bag items can also be encrypted for extra security.

Recipes

default.rb

The default recipe installs the fog RubyGem, which this cookbook requires in order to work with the Rackspace API. Make sure that the default recipe is in the node or role run_list before any resources from this cookbook are used.

"run_list": [
"recipe[rackspacecloud]"
]

The gem_package is created as a Ruby Object and thus installed during the compile phase of the Chef run.

Libraries

The cookbook has several library modules which can be included where necessary:

Attributes:

filename: The local filepath to download the file to. This is the named_attribute.

directory: The container on Rackspace Cloud Files where the file can be found or should be uploaded to.

cloudfile_uri: The path on Rackspace Cloud Files where the file can be found or uploaded to. This is the path under the container. Eg. if the full path is my_container/my_subdirectory/my_file then cloudfile_uri should be my_subdirectory/my_file. If cloudfile_uri is blank, the file is assumed to be in the root of the container, with the filename derived from the filename attribute.

rackspace_username: The Rackspace API username. Can be retrieved from data bag or node attributes.

rackspace_api_key: The Rackspace API key. Can be retrieved from data bag or node attributes.

rackspace_username: The Rackspace API username. Can be retrieved from data bag or node attributes.

rackspace_api_key: The Rackspace API key. Can be retrieved from data bag or node attributes.

rackspace_region: Region for load balancer (ORD, DFW, HKG, IAD, etc.)

action: :add_node or :remove_node. Default is :add_node.

rackspacecloud_cbs

Provides functionality to manage storage volumes and server attachments for Rackspace Cloud Block Storage including creating, attaching, detaching and deleting volumes. All actions performed are idempotent.

Actions:

:create_volume - Creates a new storage volume with the given name. If a volume with the given name exists no action will be taken. This action does not accept volume_id as a parameter.

:attach_volume - Attaches an existing storage volume to the current node. If the volume is already attached no action will be taken. If the volme is attached to another server, an exception will be raised. The volumes may be attached by name or by volume_id.

:create_and_attach - The default action. Combines create_volume and attach_volume into one action. This action does not accept volume_id as a parameter.

:detach_volume - Detaches a volume from an existing server. If the given volume is not attached no action is performed. If the volume is attached to another server, an exception will be raised. The volume may be detached by name or volume_id.

:delete_volume - Deletes an existing storage volume. A volume must be detached in order to be deleted. If the given volume does not exist no action will be taken. The volume may be identified by name or volume_id.

:detach_and_delete - Combines detach_volume and delete_volume into a single action. Volume may be identified by name or volume_id.

Node Attributes:

During the provider run, a node attribute is updated with a list of hashes describing the attached volumes. The list of attached volumes is pulled from the compute and storage api so it will include all attached volumes whether created with this recipe or not. The data is in the following format:

Example Recipe with LVM:

Below is an example of a simple recipe that creates 2 100GB cloud block storage volumes and uses LVM to create a logical volume group, format the filesystem, and mount at /var/log. This example uses the Opscode LVM recipe.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Foodcritic Metric

0.1.5 failed this metric

FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/attributes/default.rb:20FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/attributes/default.rb:21FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/attributes/default.rb:22FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/cbs.rb:274FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/recipes/default.rb:23FC017: LWRP does not notify when updated: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/file.rb:72FC017: LWRP does not notify when updated: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/record.rb:23FC017: LWRP does not notify when updated: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/record.rb:43FC017: LWRP does not notify when updated: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/record.rb:80FC019: Access node attributes in a consistent manner: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/lbaas.rb:39FC019: Access node attributes in a consistent manner: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/lbaas.rb:55FC031: Cookbook without metadata file: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/metadata.rb:1FC045: Consider setting cookbook name in metadata: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/metadata.rb:1FC048: Prefer Mixlib::ShellOut: /tmp/cook/af2df4a6598373b6ddf8ef26/rackspacecloud/providers/cbs.rb:135