Setting up a Chef environment for OpenStack

  • (4.0)
  • | 1603 Ratings

At this stage, you will have a functioning OPSCODE CHEF SERVER, as well as a PUPPETLABS RAZOR ENVIRONMENT, so we can now begin to configure our OpenStack environment. For this, our Chef Server uses a .json file to define the attributes that will make up our environment, such as networks and services.

Getting ready

To set up our environment, first log into the Chef Server and sudo to root:

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

How to achieve it…

Once logged into the Chef Server, run the following commands:

cat > /root/.chef/cookbook.json <

Once you have created the file, the next step is to import it into Chef:

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

How it works…

The OpenStack cookbooks we imported earlier, will need details about the environment to be built. The advantage of keeping these details in Chef Server environments, is it allows you to use the same Chef Server for testing, staging, and production. Further, keeping our configuration details in a file allows us to check them into a version control system to track exactly how an environment was built and changed over time.

In the cookbook.json file we created, we provided for the minimum required to stand up OpenStack. Specifically, there are several important sections. The first one configures the OpenStack Image service Glance to download the Cirros and Ubuntu Precise images. Additionally, it configures glance to allow uploads:

"glance": { "images": [
"image_upload": true

Next, we provided details for configuring the Nova Compute service. In our example, we specified that we want to use qemu as our virtualization engine. In a production environment, you would want to change this to KVM, Xen or others. Additionally, we set up an API rate limit, this is a test environment after all, and enabled volumes:

"nova": { "libvirt": {
"virt_type": "qemu"
}, "ratelimit": {
"api": { "enabled": true
}, "volume": {
"enabled": true

Next, we specify networking details. Specifically, we specify bridge devices, DNS information, how many networks to create, the size of the network and then some:

"networks": [
"label": "public", "bridge_dev": "eth1", "dns2": "", "num_networks": "1",
"ipv4_cidr": "", "network_size": "255", "bridge": "br100",
"dns1": ""

The next several sections specify how to configure services like MySQL or Monitoring as well as provide directions for where the cookbooks can find the networks configured on our nodes.

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

Related Pages:
Openstack Tutorial

Interview Questions:
Openstack Interview Questions

Subscribe For Free Demo

Free Demo for Corporate & Online Trainings.

Ravindra Savaram
About The Author

Ravindra Savaram is a Content Lead at His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter. Protection Status