Chef For Deploying OpenStack

TurnToJPG -->

Following article records all of the steps for using chef for deploying OpenStack.

Refers to:

Change vbox files

Edit the Vagrantfile for bring up the vbox, then startup the machine, modify its content , save it.

$ vim Vagrantfile
    # -*- mode: ruby -*-
    # vi: set ft=ruby : do |config| = "Trusy64"
    config.vm.box_url = ""
    config.vm.customize ["modifyvm", :id, "--memory", 1024]

Login to the running machine and modify its default repository from official to local repository.

$ vagrant up
$ vagrant ssh
(YourVagrantMachine) $ sudo vim /etc/apt/sources.list
(YourVagrantMachine) $ sudo vim /etc/apt/apt.conf
(YourVagrantMachine) $ sudo apt-get update && sudo apt-get -y upgrade

Now save your modification to the vbox file:

$ vagrant package --base vagrant_default_1433130468275_38998
$ ls Vagrantfile

Setup Chef Code

First install the vagrant plugins via:

$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-chef-zero
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin list

Get the repository from github, modify the file vagrant_linux.rb:

[xxxx@~/Code/Chef/MasterVersion]$ git clone
$ cd openstack-chef-repo
$ vim vagrant_linux.rb
  #url ''
  url ''

  #url ''
  url ''

  '' => 'ubuntu14'

Download all of the cookbooks, and modify the to Chinese mirror, Thanks for the fucking GreatFW!:

$ chef exec rake berks_vendor
$ cp -r cookbooks cookbooks.back
$ cd cookbooks
$ find . -type f -exec sed -i -e 's/https:\/\/\/\/\/rubygems/g' {} \; 

Edit the ruby definition file for avoiding Chef encountered an error attempting to load the node data for "controller":

$ vim ./aio-neutron.rb
machine 'controller' do
  add_machine_options vagrant_config: controller_config
+  chef_server( :chef_server_url => 'http://localhost:8889')
  role 'allinone-compute'
  role 'os-image-upload'

One Cookbook needs to modify, because it will automatically use source from, Thanks again for the fucking GreatFW!:

$ cd cookbooks
$ vim ./mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb
             options("--clear-sources --source") 

Now begin to provision via:

$ chef exec rake aio_neutron 2>&1 | tee aio_neutron.txt

After installation and configuration, you could visit following URL for your OpenStack: