As an advocate for OpenStack, I am always keen to help give newcomers to the open cloud ecosystem a chance to have a positive learning experience. A great tool for that is the OpenStack Cookbook lab. I’ve been lucky enough to have helped a little along the way as a reviewer for the 2nd edition of the book, and to have done some small code contributions as well.
Luckily, it doesn’t take much to run the OpenStack Cookbook lab, and most importantly, it is free!
You will need to have the following on your Mac in order to run the OpenStack Cookbook lab:
- 8GB RAM minimum (16 is ideal)
- Vagrant (http://www.vagrantup.com/)
- VirtualBox (http://www.virtualbox.org/)
- Internet access
I highlight internet access because you can run the cookbook lab without internet access, but only once it is fully downloaded and built. The lab works great for me during testing when on the road and while disconnected, but we do run a live download of the code and base machines during the setup process.
NOTE: Once you’ve installed Vagrant, it is highly recommended to also install the vagrant-cachier plugin. I’ve documented that process here: http://discoposse.com/2014/11/24/c-r-e-a-m-cache-rules-everything-around-me-with-vagrant-cachier/
Downloading the OpenStack Cookbook code
git clone https://github.com/OpenStackCookbook/OpenStackCookbook.git
Let’s change directory to the OpenStack Cookbook folder with the
cd OpenStackCookbook and then we will want to ensure that we are on the stable Kilo branch of the cookbook using
git checkout kilo to set the branch:
Now comes the fun part!
Since you have the Vagrant and VirtualBox all set up on your system and the code is downloaded, it’s time to start up the build of the lab. This is easily done thanks to the magic of automation by using the
vagrant up --provider=virtualbox/command:
You will be prompted for credentials during the process of the build at least once as it needs to set up NFS shares to map the /vagrant/ directory from the guest virtual machines to your local host for access the build scripts on the shared folder:
The build takes about 20-30 minutes depending on your internet connection speed and the CPU, memory, and disk performance in your lab host. Once it’s all done building you will see a screen similar to this:
Now it’s time to start up the demo script which will build out the first Neutron router, some floating IP addresses, download a couple of guest instance images to Glance, and spark up a Nova instance. This is done from the console of the controller virtual machine.
First, SSH into the machine from the command line using the
vagrant ssh controller command:
Next, we import the openrc file to put some environment variables together which will give us access to the endpoints to run the demo script. That’s done by using the
. /vagrant/openrc command:
The last step is to run the demo script which is located in the /vagrant/ folder that’s mapped to your local system with the
/vagrant/demo.sh command. You will see a bunch of content roll by on the screen and you can scroll up to see all of the commands that were run and the results:
Results will complete with the final command showing an associated floating IP:
Now you open up your browser to access the Horizon dashboard at http://172.16.0.200 using the default credentials for the lab which is a username of admin and a password of openstack to log in:
Click on the Projects tab in the left hand pane and then the Instances menu option to see the active instance that was spun up with the demo script:
You now have a two-node OpenStack on KVM lab running and you can dig around to see all of the various features and functionality available.
More OpenStack Cookbook Resources
I will be doing some other posts to show a few nifty ways to use the OpenStack Cookbook lab to learn about the various project features.
Read here on how to suspend and resume your OpenStack Cookbook lab using Vagrant suspend and awk.
That said, there is nothing that makes a better companion to your OpenStack Cookbook lab than the actual guide written by Cody Bunch, Kevin Jackson, and Egle Sigler, which is available here: http://www.amazon.com/OpenStack-Cloud-Computing-Cookbook-Third/dp/1782174788/ref=sr_1_1?ie=UTF8&qid=1448141088&sr=8-1&keywords=openstack+cookbook
You can also read through some great posts at the home site for the book at http://www.openstackcookbook.com