Installing PuppetLabs Razor and DHCP

There are a number of provisioning systems, such as Cobbler, Kick-start, and Ubuntu’s own MAAS, to provision an operating system such as Ubuntu to bare-metal. In this instance, we are switching from Ubuntu’s Metal as a Service to the PuppetLabs Razor service to allow you more flexibility within your deployment. PuppetLabs Razor, like MAAS, provides a PXE boot environment for your OpenStack nodes. Additionally, when a node PXE boots, it boots into the Razor Micro Kernel environment which in turn runs PuppetLabs Facter and reports back lots of details about the physical node. From there, you can use the Razor CLI or Razor API to query inventory details about a machine or set of machines and provision an OS to them. An additional feature is the “broker”, which allows for a hand-off to a DevOps framework. In this section, we will cover using the Razor cookbooks to install Razor onto the node.

Getting started

To get started, we need to log into our Chef Server:

vagrant ssh chef

How to achieve it…

On the Chef Server, we need to configure a number of attributes for both the DHCP service as well as the Razor service before we can log into the Razor node and apply the configuration. To do this, execute the following commands:

sudo cat > ~/.chef/razor.json <<EOF
"name": "razor.book", "chef_environment": "_default", "normal": {
"dhcp": { "parameters": {
"next-Server": "
"networks": [ "172-16-0-0_24" ], "networks_bag": "dhcp_networks"
}, "razor": {
"bind_address": "
"images": { "razor-mk": {
"type": "mk", "url":
"action": "add"
: {
"url": "http://mirror.anl.gov/pub/ubuntu-iso/CDs/precise/ubuntu-12.04.2-Server-amd64.iso",
"version": "12.04
"action": "add"
"tags": []
"run_list": [ "recipe[razor]", "recipe[dhcp::server]"
knife node from file ~/.chef/razor.json

Now that we have configured our environment, we can log into the Razor node and finish our installation:

vagrant up razor vagrant ssh razor
sudo mkdir -p /etc/chef
sudo scp user@host:/location/of/chef-validator.pem /etc/chef/validation.pem
sudo echo "                              chef.book" >> /etc/hosts
# Install chef client
curl -L https://www.opscode.com/chef/install.sh | sudo bash
# Make client.rb
sudo cat > /etc/chef/client.rb <<EOF log_level :info
log_location STDOUT chef_server_url 'https://chef.book/'
validation_client_name      'chef-validator'
sudo chef -client

How it works…

In this particular section, there are a number of things happening. First, we logged into our Chef Server and created a node definition file that specifies how our Razor node should be configured. Specifically, in the “dhcp”: section we specified the “next-Server” as being the Razor node. Additionally, configure the DHCP service to use the networking parameters we specified in the databag earlier. In the “Razor” section, we tell the Razor service to bind to our private network address. Additionally, we tell it about what images to be used and where they can be downloaded from. The last thing we configured in the node definition file was the “run_list”, or recipes to apply to the node. In this case, we specified that we want to install Razor as well as the dhcp::Server components.

Once we completed our configuration on the Chef Server, we switched over to the Razor node, copied in the Chef validation certificate. This allows the Chef Client to register with the Chef Server. Next, we put an entry into the /etc/hosts file to allow our Razor Server to identify where the Chef Server is. Next, we installed and configured the Chef Client using the same curl script we did when setting up the Chef Server. Finally, we executed the Chef Client which preformed a number of actions such as register with the Chef Server and execute the recipes in our run-list.



0 Responses on Installing PuppetLabs Razor and DHCP"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.