Module of the Week: puppetlabs/razor – Razor Provisioning Application

Purpose Razor Provisioning Software
Module puppetlabs/razor
Puppet Version 2.7+
Platforms Ubuntu Precise
Razor is next generation provisioning software that handles bare metal hardware and virtual server provisioning with inventory discovery and tagging, rule-based policy management, and extensible broker plugin integration. The usage of Razor for provisioning is discussed briefly in this blog, and additional information is available on a separate post by Nick Weaver, one of authors of the Razor project. Broker handoffs will be discussed in a follow up article. Razor is currently released as a beta for preview, so there are no installation packages yet. The Razor module is intended to simplify the process for installing Razor, since it handles all application dependencies, and clones the Razor repo from GitHub. The module is limited to Ubuntu Precise due to the availability of nodejs packages. In Debian, these packages are available in sid, so install this module only if you are comfortable adding the unstable repo. Razor puppet module support for other platforms will be evaluated as we continue to develop Razor (this is not the same as node provisioning platforms which includes Debian, Ubuntu, RedHat, OpenSuSE, and VMware ESX).

Installing the module

Complexity Easy
Installation Time 5 minutes
On puppet 2.7.14 an PE 2.5, puppet module tool will automatically download and install all dependencies from forge.
$ puppet module install puppetlabs-razor
Preparing to install into /etc/puppet/modules ...
Downloading from ...
Installing -- do not interrupt ...
└─┬ puppetlabs-razor (v0.1.0)
  ├─┬ puppetlabs-mongodb (v0.0.1)
  │ └── puppetlabs-apt (v0.0.3)
  ├── puppetlabs-nodejs (v0.2.0)
  ├── puppetlabs-stdlib (v2.3.2)
  ├── puppetlabs-tftp (v0.1.0)
  ├── puppetlabs-vcsrepo (v0.0.4)
  └── saz-sudo (v2.0.0)
Once all the modules have been installed, the appropriate permission should be applied to the files under the modules folder:
$ chown -R puppet:puppet /etc/puppet/modules

Configuring the module

Complexity Easy
Installation Time 5 minutes
The puppetlabs/razor module does not deploy DHCP service. The DHCP server needs to specify the initial boot file as pxelinux.0 and next-server option should direct traffic to the tftp server.If you currently don’t have DHCP service in your environment, and have control over your network environment, the puppetlabs/dhcp module will deploy dhcp services.
class { 'dhcp':
  dnsdomain   => [
  nameservers => [''],
  ntpservers  => [''],
  interfaces  => ['eth0'],
  pxeserver   => '',
  pxefilename => 'pxelinux.0',
If you want to test Razor on your local system in a virtual environment such as VMware Fusion 4, simply add the following lines into /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf the appropriate DHCP subnet and substitute $tftp_server_address with the Razor VM node ipaddress:
filename "pxelinux.0";
next-server ${tftp_server_ipaddress};
At the moment, the tftp service and razor service will be deployed to the same system. On the puppet master assign the razor class to the appropriate node, and trigger a puppet agent run afterwards:
node razor_host {
  class { 'sudo':
    config_file_replace => false,
  class { 'razor':
    username  => 'razor',
    directory => '/opt/razor',
Razor can also be deployed directly to the system with the modules installed via:
puppet apply /etc/puppet/modules/razor/tests/init.pp --verbose
At this point, login to the Razor installation directory and execute Razor to confirm the application is installed successfully:
$ /opt/razor/bin/razor
ProjectRazor - v0.1.6.0

	project_razor [slice name] [command argument] [command argument]...
		 --debug        : Enables printing proper Ruby stacktrace
		 --verbose      : Enables verbose object printing
		 --no-color-out : Disables console color. Useful for script wrapping.

Loaded slices:
	[bmc] [broker] [image] [log] [model] [node]
	[policy] [tag]
Ensure the Razor service is running:
$ /opt/razor/bin/razor_daemon.rb status
razor_daemon: running [pid 6421]
*note: We are providing an update to the module in v0.1.2 which will start the service by default.

Example usage

The example below will show the minimal steps from the end of Razor installation to provisioning an Ubuntu Precise system. We will focus on the process of getting a new system provisioned with Ubuntu. Razor needs a micro kernel (MK) image upon initial pxeboot to detect hardware information and register systems to the inventory of nodes. The MK image is available on GitHub, and it should be loaded into razor image service first:
$ wget
$ razor image add mk ./rz_mk_dev-image.
Attempting to add, please wait...
New image added successfully
	UUID: 1nnkuB5BiH1C93HOO0PTFi
	Type: MicroKernel Image
	ISO Filename: rz_mk_dev-image.
	Path: /mnt/nfs/Razor/image/mk/1nnkuB5BiH1C93HOO0PTFi
	Status: Valid
	Build Time: 2012-05-09 13:11:01 -0700
Once the razor MK images is loaded into Razor, new system connected to the network performing network boot will obtain a dhcp address, boot the microkernel and register with Razor. We can get a list of systems discovered via this process via the Razor node:
$ razor node
Discovered Nodes
         UUID           Last Checkin                  Tags
5PfILygjPv4WTayOnTOYMk  32 seconds     [cpus_1,memsize_4GiB,nics_1,vmware_vm]
26k3If4FI7HpsZIn7N7BXu  45 seconds     [cpus_2,memsize_16GiB,nics_2,vmware_vm]
66XZwZUJOpRXosg5SHHdbW  7 seconds      [cpus_4,memsize_96GiB,nics_4,physical]
Attributes regarding specific nodes can be drilled down into further details by specifying its UUID:
$ razor node attrib 5PfILygjPv4WTayOnTOYMk
Node Attributes:
          	Name                        Value
	architecture              i386
	domain                    localdomain
	fqdn                      mk000C294F881F.localdomain
	hardwareisa               unknown
	hardwaremodel             i686
	hostname                  mk000C294F881F
To provision a node, an Ubuntu Precise ISO should also be loaded along with a model which associates an instance of model template configuration with a specific ISO image:
$ razor image add os ../ubuntu-12.04-server-amd64.iso ubuntu_precise 12.04
Attempting to add, please wait...
New image added successfully
	UUID: 274HnNlQF5jvbo0y6U0aok
	Type: OS Install
	ISO Filename: ubuntu-12.04-server-amd64.iso
	Path: /mnt/nfs/Razor/image/os/274HnNlQF5jvbo0y6U0aok
	Status: Valid
	OS Name: ubuntu_precise
	OS Version: 12.04
Once the MK and operating system images are loaded into razor, we can create a deployment model using that image. First, list the available model templates:
$ razor model get template
Model Templates:
Template Name         Description         
centos_6        CentOS 6 Model            
debian_wheezy   Debian Wheezy Model       
opensuse_12     OpenSuSE Suse 12 Model    
ubuntu_oneiric  Ubuntu Oneiric Model      
ubuntu_precise  Ubuntu Precise Model      
vmware_esxi_5   VMware ESXi 5 Deployment
Next, select the ubuntu_precise template along with the iso_uuid generated when the ISO was loaded into Razor. This will trigger a series of configuration questions applicable for the Precise model template:
$ razor model add template=ubuntu_precise label=install_precise image_uuid=274HnNlQF5jvbo0y6U0aok
--- Building Model (ubuntu_precise):
Please enter node hostname prefix (will append node number) (example: node)
default: node
(QUIT to cancel)
> ubuntu
Please enter root password (> 8 characters) (example: P@ssword!)
default: test1234
(QUIT to cancel)
> testEnvPass!
Model created
Label =>  install_precise
Template =>  linux_deploy
Description =>  Ubuntu Precise Model
UUID =>  3LCN86Cpx0Te3Of5WbORkQ
Image UUID =>  274HnNlQF5jvbo0y6U0aok
The newly created model contains the hostname (which will be appended with node number), root password, and the ISO for deployment. We can certainly perform more customization within the preseed file, but in most cases this process is deferred to Puppet via broker plugin which will configure the target puppet master to handoff the node for management. At this point we can deploy this operating system, and based on our initial hardware inventory we will target nodes with 4GB of memory that are VMware virtual systems.
$ razor policy add template=linux_deploy label=precise model_uuid=3LCN86Cpx0Te3Of5WbORkQ broker_uuid=none tags=memsize_4GiB,vmware_vm enabled=true
Policy created
UUID =>  41o1z77j2R4ZsgjD9KTpPe
Line Number =>  2
Label =>  precise
Enabled =>  true
Template =>  linux_deploy
Description =>  Policy for deploying a Linux-based operating system.
Tags =>  [vmware_vm]
Model Label =>  install_precise
Broker Target =>  none
Bound Count =>  0
At this point we review our policy rules and based on razor node output we expect one system that matches the tag requirements to deploy Precise.
$ razor policy
#  Enabled     Label         Tags              Label          Count           UUID
0  true     precise  [memsize_4GiB,vmware_vm]  install_precise  0      41o1z77j2R4ZsgjD9KTpPe
In the future, other systems that match this policy rule will also deploy Precise. Once the appropriate nodes install Precise, we can either remove this policy completely via ‘policy remove <uuid>’ or temporarily disable it via ‘policy disable <uuid>’.


The Razor puppet module provides a quick and easy way to install Razor for testing. The module could benefit from additional puppet class parameters for razor::nodejs and razor::tftp that separates those components especially when tftp can be installed on a separate system. There are also manual processes in Razor such as loading ISO’s that could benefit from a Puppet type/provider. We certainly welcome recommendations for additional Razor service deployment platform, and contributions from our community for enhancements to this module and its dependencies. Learn More:
Puppet sites use proprietary and third-party cookies. By using our sites, you agree to our cookie policy.