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.
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.
To gain in-depth knowledge and be on par with practical experience, then explore OpenStack Training course.
Getting started
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| config.vm.box = "precise64"
config.vm.box_url = "https://files.vagrantup.com/precise64.box" 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}.cook.book" box.vm.network :private_network, ip: "172.16.0.#
{ip_start+i}", :netmask => "255.255.0.0"
# If using Fusion
box.vm.provider :vmware_fusion do |v| v.vmx["memsize"] = 1024
if prefix == "chef" v.vmx["memsize"] = 3128
end
end
# Otherwise using VirtualBox box.vm.provider :virtualbox do |vbox|
# Defaults
vbox.customize ["modifyvm", :id, "--memory",
1024]
vbox.customize ["modifyvm", :id, "--cpus", 1]
if prefix == "chef"
vbox.customize ["modifyvm", :id, "--memory",
3128]
end
end
end
end
end
end
Finally, let’s power on the Chef Server node and login:
vagrant up Chef
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 https://opscode-omnitruck-release.s3.amazonaws.com/ubuntu/12.04/x86_64/Chef-Server_11.0.6-1.ubuntu.12.04_amd64.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
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.
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
Now that you are logged in, issue the following command to install the Chef Client:
sudo apt-get install -y curl
curl -L https://www.opscode.com/chef/install.sh | 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:="" chef.cook.book'="" cookbook_path="" '="" root="" cookbooks="" syntax_check_cache_path="" syntax_check_cache'="" eof=""
The Chef Client is installed using a curl command, which streams the output of install.sh 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.
Name | Dates | |
---|---|---|
OpenStack Training | Nov 02 to Nov 17 | View Details |
OpenStack Training | Nov 05 to Nov 20 | View Details |
OpenStack Training | Nov 09 to Nov 24 | View Details |
OpenStack Training | Nov 12 to Nov 27 | View Details |
Ravindra Savaram is a Technical Lead at Mindmajix.com. 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.