- Website: http://bbg-cookbooks.github.io/razor
- Opscode Community Site: http://community.opscode.com/cookbooks/razor
- Source Code: https://github.com/bbg-cookbooks/razor
Chef cookbook to install and manage Razor, a power control, provisioning, and management application designed to deploy both bare-metal and virtual computer resources. An LWRP is provided to manage OS and micro kernel images.
Include recipe[razor]
in your run_list to install the Razor service and its
dependencies. If you wish to modify or alter the details of the installation
(i.e. using a different mongodb cookbook, installing nodejs from source, etc.),
then compose a custom run_list of the child recipes described
below.
Tested on 10.14.4 and 11.2 but newer and older version should work just fine. File an issue if this isn't the case.
The following platforms have been tested with this cookbook, meaning that the recipes run on these platforms without error:
- ubuntu (10.04/12.04/12.10)
This cookbook depends on the following external cookbooks:
Depending on the situation and use case there are several ways to install this cookbook. All the methods listed below assume a tagged version release is the target, but omit the tags to get the head of development. A valid Chef repository structure like the Opscode repo is also assumed.
To install this cookbook from the Opscode Community Site, use the knife command:
knife cookbook site install razor
Berkshelf is a cookbook dependency manager and development workflow assistant. To install Berkshelf:
cd chef-repo
gem install berkshelf
berks init
To use the Opscode Community Site version:
echo "cookbook 'razor'" >> Berksfile
berks install
Or to reference the GitHub version:
repo="bbg-cookbooks/razor"
latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
| ruby -rjson -e '
j = JSON.parse(STDIN.read);
puts j.map { |t| t["ref"].split("/").last }.sort.last
')
cat >> Berksfile <<END_OF_BERKSFILE
cookbook 'razor',
:git => 'git://github.com/$repo.git', :branch => '$latest_release'
END_OF_BERKSFILE
berks install
Librarian-Chef is a bundler for your Chef cookbooks. To install Librarian-Chef:
cd chef-repo
gem install librarian
librarian-chef init
To use the Opscode Community Site version:
echo "cookbook 'razor'" >> Cheffile
librarian-chef install
Or to reference the GitHub version:
repo="bbg-cookbooks/razor"
latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
| ruby -rjson -e '
j = JSON.parse(STDIN.read);
puts j.map { |t| t["ref"].split("/").last }.sort.last
')
cat >> Cheffile <<END_OF_CHEFFILE
cookbook 'razor',
:git => 'git://github.com/$repo.git', :ref => '$latest_release'
END_OF_CHEFFILE
librarian-chef install
Installs the full Razor stack with all dependencies.
Most users will want to use this recipe.
Installs a tftp server. This recipe is included in the default recipe.
Installs files and configuration needed for PXE booting and Razor bootstraping. This recipe is included in the default recipe.
Installs a MongoDB server (from packages) if the "mongo"
persistance mode is
selected and the mongo/local_server
attribute is set to a truthy value
(otherwise the recipe is effectively skipped). This recipe is included in the
default recipe.
Installs a PostgreSQL server if the "postgres"
persistent mode is selected
and the postgres/local_server
attribute is set to a truthy value. Otherwise
the PostgreSQL client libraries are installed. This recipe is included in the
default recipe.
Installs Node.js and npm (from packages). This recipe is included in the default recipe.
Installs Ruby (from system packages) and the Bundler gem. This recipe is included in the default recipe.
Installs Rubygems from source on older Debian/Ubuntu platforms that ship a crippled Rubygems package. This recipe is included in the ruby_from_package recipe and will only be used on Ubuntu 10.04 nodes.
Installs and configures the Razor codebase and service. This recipe is included in the default recipe.
Installs images in the Razor service (driven off the images
attribute). This
recipe is included in the default recipe.
IP address to which the Razor web services are bound.
The default is set to node['ipaddress']
.
The micro kernel checkin interval in seconds.
The default is 60
.
The persistence mode that Razor will use. Currently the two supported values are "mongo"
and "postgres"
.
The default is "mongo"
.
Note: The is some upstream Razor code changes needed to support PostgreSQL
authentication via a username and password. In the meantime, your mileage may
vary when using the "postgres"
persistence mode.
The hostname or IP adrress of the persistence service.
The default is "127.0.0.1"
.
The port number of the persistence service.
The default depends on which persist_mode is selected:
"mongo"
: the value set will be the value ofnode['mongodb']['port']
if set and falling back to27017
."postgres"
: the value set will be the value ofnode['postgresql']['config']['port']
if set and falling back to5432
.
The username used when authenticating to the persistence service.
The default depends on which persist_mode is selected:
"mongo"
: a value is not set as the default localhost server does not require authentication."postgres"
: defaults to"razor"
.
The password used when authenticating to the persistence service.
The default depends on which persist_mode is selected:
"mongo"
: a value is not set as the default localhost server does not require authentication."postgres"
: defaults to"project_razor"
.
Note do not rely on a default password if at all possible. Securing your persistence serivce with adequate password strength is your responsibility.
The connection timeout (in secondss) used when communicating with the persistence service.
The default is 10
.
Whether or not to install a local MongoDB server on this node. If you want
Razor to use an external MongoDB server then set this value to something
"untruthy" such as false
or nil
.
The default depends on which persist_mode is selected:
"mongo"
: defaults totrue
."postgres"
: defaults tofalse
.
Whether or not to install a local PostgreSQL server on this node. If you want
Razor to use an external PostgreSQL server then set this value to something
"untruthy" such as false
or nil
.
The default depends on which persist_mode is selected:
"mongo"
: defaults tofalse
."postgres"
: defaults totrue
.
A Hash of Razor images to be added. The hash key will correspond to the image
name
attribute and the value will be a hash of other attributes to be fed
to the razor_image LWRP. For example:
node['razor']['images'] = {
'razor-mk' => {
'type' => 'mk',
'url' => 'http://fdqn.com/razor-mk.iso',
'action' => 'add'
},
'precise64' => {
'url' => 'http://example.com/precise64.iso',
'checksum' => 'abcabc...',
'version' => '12.04'
}
}
The default is an empty hash: Hash.new
.
An Array of system packages which will install the Ruby runtime. The defaults are set automatically based on platform and platform_version but can be overridden in needed.
An Array of npm packages to be installed. The defaults are set automatically but can be overridden in needed.
The install base path of the Razor codebase.
The default is "/opt/razor"
.
The bundle command which will be used to install Ruby gems.
The default is "bundle"
(using $PATH
lookup).
The npm command which will be used to install npm packages.
The default is "npm"
(using $PATH
lookup).
The Git URL for the Razor codebase.
The default is "https://github.com/razor-provisioning/Razor.git"
.
The Git reference/branch to check out.
The default is "0.9.0"
. Valid values could be Git SHA hashes, branch names,
and "master"
for tracking development.
The version of Rubygems to be compiled (when necessary).
The default is "1.8.24"
.
The URL containing Rubygems source which will be compiled (when necessary).
The default is set based on the Rubygems version attribute above.
IP address which has a running MongoDB service.
The default is "127.0.0.1"
.
Note this value will set the persist_host
attribute for backwards compatibility. This attribute will be removed in a 1.0
release so please migrate to using persist_host
.
Action | Description | Default |
---|---|---|
add | Add the microkernel or operating system image to razor. | Yes |
Attribute | Description | Default Value |
---|---|---|
name | Name attribute: The logical name to use for the image. | nil |
type |
The type of image. Valid values are "mk" for micro kernel
images and "os" for operating system images.
|
"os" |
url | HTTP URL containing the image ISO. | nil |
version |
The version to use for "os" images only.
|
nil |
checksum | An optional SHA-256 checksum for the ISO (for added verification). | nil |
iso_path |
An optional path where the downloaded ISO image will be stored before
being added to Razor. If no value is provided a path inside the
Chef::Config[:file_cache_path] will be computed.
|
nil |
razor_image "rz_mk_prod-image.0.9.1.6" do
type "mk"
url "http://mirror.example.com/images/rz_mk_prod-image.0.9.1.6.iso"
checksum "aljdflkjflajkf..."
action :add
end
razor_image "rz_mk_prod-image.0.9.1.6" do
type "mk"
url "http://mirror.example.com/images/rz_mk_prod-image.0.9.1.6.iso"
end
Note: the add action is default, so the second example is a more common usage.
razor_image "precise64" do
type "os"
url "http://mirror.example.com/images/ubuntu-amd64-12.04.iso"
checksum "lkjdfoidadba..."
version "12.04"
iso_path "/data/razor_images"
end
razor_image "sl64-6.3" do
url "http://mirror.example.com/images/scientific-amd64-6.3.iso"
version 6.3
end
Note: the default for type is "os"
so this can be omitted in most cases.
The version attribute can also be a Float.
- Source hosted at GitHub
- Report issues/Questions/Feature requests on GitHub Issues
Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make.
Author:: Fletcher Nichol (fnichol@nichol.ca)
Copyright 2012, Blue Box Group, LLC
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.