OpenStack is a large and fast moving project. It is a cloud operating system that provides support for provisioning large networks of virtual machines, pluggable and scalable network and IP management, and object and block storage.

OpenStack is a suite of software, designed to offer scale-out cloud environments deployed in data centers around the world. Managing the installation of software in a remote location is different (and sometimes challenging), compared to being able to install software locally, and so tools and techniques have been developed to ease this task. Design considerations of how to deal with hardware and software failure must also be taken into consideration in operational environments.

This field of topics introduces some methods and software that will allow you to extend your DevOps or infrastructure as code approaches into your OpenStack environment. The recipes here are used when you start to move out of the testing phase and into managing a production OpenStack. They give you the basis for building and rebuilding various aspects of your environment on the fly, as well as expanding or contracting the environment dynamically.

To gain in-depth knowledge and be on par with practical experience, then explore  OpenStack Training course.


Notes for this edition of the OpenStack Cookbook

There are a lot and lots of choices when it comes to the bare-metal and automated provisioning of an OpenStack environment. In this edition, after some discussion with Kevin and those in the community, we decided to change gears from Ubuntu’s MaaS to something that would allow for a greater degree of flexibility. After considering the great work going on in the TripleO project and Bare Metal OpenStack, we decided that while great progress is being made in those projects, we, at this time are going to print with PuppetLabs Razor and Chef.
In our automated OpenStack installation symphony, each tool has a single job and was chosen because it suits its job role well. However, we also designed this section so that various tools could be swapped out with their analogues as well. So while we use Chef, you can use Puppet, and so on.

Frequently Asked OpenStack Interview Question & Answers

Installing Opscode Chef Server

Chef is a configuration management and automation tool for information technology professionals that configures and manages your infrastructure, whether it is on-premises or in the cloud. It can be used to speed up application deployment and to coordinate the work of multiple system administrators and developers involving hundreds, or even thousands, of servers and applications to support a large customer base.
Opscode Chef Server provides our OpenStack automation system with a configuration management framework. In this case, a configuration management framework allows us to specify, much like we have in Vagrant in other places, explicitly how we want our environment to be installed, configure, and behave. Each platform, Opscode Chef, PuppetLabs, Ansible, Salt, and others, have their own terminology for the various pieces. In our example recipes, we will be using OpsCode Chef. Thus, you will see some of the following terms commonly:
Cookbook: A cookbook is a collection of recipes to perform specific tasks. Much like the cookbook you are now reading.
Recipes: A recipe is the basic building block for Chef. It performs a specific task. Say installing an NTP Server.
Role: A role is a Server function, defined by a collection of recipes and cookbooks to be applied in a specific order.
Node: A node can be considered along with the Server or instance that these configurations will be applied to. We will install OpenStack in three nodes: control, network and compute.
As we progress, we will use cookbooks to state how our environment should be configured. The Chef server maintains the working copy of the node and environment attributes. Additionally, it contains the role and cookbook definitions, we then assign to nodes to complete the configuration.

Getting started

Subscribe to our youtube channel to get new updates..!

As we have in every discussed everywhere, we are using Vagrant and VirtualBox to build our environment. For this field, however, we are building a new environment so we will need to issue the following commands:

mkdir Auto_Openstack cd Auto_Openstack/ vagrant init

Next, we need to edit our Vagrant file so it looks like the following:

nodes = {

 => [1, 100],
‘razor’  => [1, 101],
‘node’  => [3, 103],
Vagrant.configure("2") do |config| = "precise64"
config.vm.box_url = "" config.vm.usable_port_range= 2800..2900
nodes.each do |prefix, (count, ip_start)| count.times do |i|
hostname = "%s" % [prefix, (i+1)]
config.vm.define "#{hostname}" do |box| box.vm.hostname = "#{hostname}" :private_network, ip: "172.16.0.#
{ip_start+i}", :netmask => ""
# If using Fusion
box.vm.provider :vmware_fusion do |v| v.vmx["memsize"] = 1024
if prefix == "chef" v.vmx["memsize"] = 3128
# Otherwise using VirtualBox box.vm.provider :virtualbox do |vbox|
# Defaults
vbox.customize ["modifyvm", :id, "--memory",
vbox.customize ["modifyvm", :id, "--cpus", 1]
if prefix == "chef"
vbox.customize ["modifyvm", :id, "--memory",

Finally, let’s power on the Chef Server node and login:

vagrant up Chef

How to accomplish it…

Log into the Chef Server created with Vagrant:

vagrant ssh chef

To install the Chef Server, issue the following commands:

wget -O chef-server-11.deb
sudo dpkg -i chef-server-11.deb
sudo chef-server-ctl reconfigure sudo chef-server-ctl test
mkdir ~/.chef
sudo cp /etc/chef-server/admin.pem ~/.chef
sudo cp /etc/chef-server/chef-validator.pem ~/.chef

How it works…

The preceding commands download the Opscode Omnibus installer for the Chef Server and then execute the package. Next, we use the chef-server-ctl command to perform the initial configuration of the Chef Server and to test our installation. Finally, we move our Chef Server certificate files into a known location for use later.

Installing Chef Client

All of the nodes in your OpenStack cluster need to have chef-client installed and configured to communicate with the Chef server, which also provide us with Knife utility. The Knife utility is how we issue commands and perform configurations on the Chef Server and for our nodes.

Getting started

Log into the Chef Server node by issuing the following Vagrant command:

vagrant ssh chef
Explore OpenStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!  Download Now!

How to do it…

Now that you are logged in, issue the following command to install the Chef Client:

sudo apt-get install -y curl
curl -L | sudo bash
sudo cat > ~/.chef/knife.rb <<eof log_level="" :info="" log_location="" stdout="" node_name="" 'admin'="" client_key="" '~="" .chef="" admin.pem'="" validation_client_name="" 'chef-validator'="" validation_key="" chef-validator.pem'="" chef_server_url="" 'https:=""'="" cookbook_path="" '="" root="" cookbooks="" syntax_check_cache_path="" syntax_check_cache'="" eof="" 

How it works…

The Chef Client is installed using a curl command, which streams the output of to the bash command line. Next, we create a file that provides the configuration for the knife utility, specifying where it can find our Chef Server as well as the certificate files.