Chef, Razor, OpenStack – Part 3

IMG_5461Ok, we’re now really deep into things. Because I’ve been a few weeks in getting this post out there, and because the material is deep in places, you may want to review:

  • Part 1 – Installing Chef and importing cookbooks.
  • Part 2 – Using Chef to bootstrap Razor

Back with us? Ok! So, our current state of affairs: We have a Chef Server running. We also have DHCP and Razor running. In this post, we have the following tasks left to complete:

  1. Create an Chef environment for OpenStack
  2. Boot a net new node into Razor
  3. Add the “all in one” role to the node
  4. Run Chef Client
  5. Get coffee
  6. Awesome!

Getting Started

Log into the Chef server and do the following:

cat > ~/.chef/cookbook.json <<EOF
“name”: “cookbook”,
“description”: “OpenStack Cookbook environmnet”,
“cookbook_versions”: {
“json_class”: “Chef::Environment”,
“chef_type”: “environment”,
“default_attributes”: {
“override_attributes”: {
“glance”: {
“images”: [
“image_upload”: true
“nova”: {
“libvirt”: {
“virt_type”: “qemu”
“ratelimit”: {
“api”: {
“enabled”: true
“volume”: {
“enabled”: true
“networks”: [
“label”: “public”,
“bridge_dev”: “eth1”,
“dns2”: “”,
“num_networks”: “1”,
“ipv4_cidr”: “”,
“network_size”: “255”,
“bridge”: “br100”,
“dns1”: “”
“developer_mode”: false,
“mysql”: {
“allow_remote_root”: true,
“root_network_acl”: “%”
“osops_networks”: {
“nova”: “”,
“public”: “”,
“management”: “”
“monitoring”: {
“metric_provider”: “collectd”,
“procmon_provider”: “monit”

knife environment from file ~/.chef/cookbook.json

Boot the First OpenStack Node

Next, create yourself a new VM, connect it to the same network as your Razor server, and allow it to PXE boot. If you completed Part 2, specifically, if you created the policy and enabled it, you can now log into the razor node and watch things happen with:

watch razor  active_model logview

Depending on your system, it will be somewhere between 8 and 35 minutes before Razor hands off to Chef. You will be looking for “Broker Success” in the output of the active_model command above.

Edit the Node

Ok, so now that the node is booted, Ubuntu installed, and been handed off to Chef, we can add it to our cookbook environment and assign it an OpenStack role. From the Chef server:

EDITOR=vim knife node edit

Change this line:

    “chef_environment”: “cookbook”,

Add this line:

“run_list”: [

Finally, log into the node and:


Adding Nodes

To add nodes, you will boot more of them via Razor & let them install / hand off to chef. On chef, add the role “single-compute” to the additional nodes. Here’s what an install would look like after adding the second node via single-compute:

# nova-manage service list
Binary           Host                                 Zone             Status     State Updated_At
nova-scheduler   node1                                internal         enabled    🙂   2013-05-22 19:41:56
nova-conductor   node1                                internal         enabled    🙂   2013-05-22 19:41:56
nova-cert        node1                                internal         enabled    🙂   2013-05-22 19:41:56
nova-consoleauth node1                                internal         enabled    🙂   2013-05-22 19:41:56
nova-network     node2                                internal         enabled    🙂   2013-05-22 19:41:56
nova-compute     node2                                nova             enabled    🙂   2013-05-22 19:42:01


IMG_5462Thanks for hanging in there for another “zomg a lot of words” post. However, at the end of this, you will have built yourself an OpenStack building factory.

As always, follow me on Twitter and drop a like should you have any questions or comments.

2 thoughts on “Chef, Razor, OpenStack – Part 3

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.