Skip to content

Instantly share code, notes, and snippets.

@Keoven
Forked from vishvananda/devstack.rb
Created February 20, 2012 03:28
Show Gist options
  • Save Keoven/1867590 to your computer and use it in GitHub Desktop.
Save Keoven/1867590 to your computer and use it in GitHub Desktop.
Vagrant script for devstack
openstack-cookbooks
.vagrant
cache
#! /usr/bin/env bash
## Install VirtualBox
#
# curl -O http://download.virtualbox.org/virtualbox/4.1.4/VirtualBox-4.1.4-74291-OSX.dmg
# open VirtualBox-4.1.4-74291-OSX.dmg
## Install Vagrant
# sudo gem install vagrant --no-rdoc --no-ri
## Run the next few commands or run this script
#
# bash -s stable < <(curl -s https://raw.github.com/gist/1867590/install)
## Create Directories
#
rm -rf ~/Vagrant
mkdir ~/Vagrant
mkdir ~/Vagrant/OpenStack
mkdir ~/Vagrant/OpenStack/cache
mkdir ~/Vagrant/OpenStack/cache/stack # GIT repos are cloned here and shared via NFS
## Get Chef Scripts
#
git clone git://github.com/Keoven/openstack-cookbooks.git -b localrc-template-update -o localrc-template-update ~/Vagrant/OpenStack/openstack-cookbooks
cd ~/Vagrant/OpenStack
curl -o Vagrantfile https://raw.github.com/gist/1867590/Vagrantfile
vagrant up
# You will need to enter your password for creating NFS shares.
# When it is finished you should be able to access dashboard at 192.168.27.100
#! /usr/bin/ruby -w
Vagrant::Config.run do |config|
sshdir = "#{ENV['HOME']}/.ssh/"
cachedir = (ENV['CACHEDIR'] or "#{ENV['HOME']}/Vagrant/OpenStack/cache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/Vagrant/OpenStack/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.27.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027027")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "oneiric"
config.vm.box_url = "http://images.ansolabs.com/vagrant/oneiric64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
if(Vagrant::VERSION.match(/^0\.8.*$/))
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
else
config.vm.network(:hostonly, ip, :mac => "#{mac_prefix}#{suffix}")
end
config.vm.share_folder("v-cache", "/home/vagrant/cache", cachedir, :nfs => true)
config.vm.share_folder("v-ssh", "/home/vagrant/.host-ssh", sshdir)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "#{checkout}/cookbooks"
chef.roles_path = "#{checkout}/roles"
chef.log_level = :debug
chef.run_list = [
"recipe[anso::cache]",
"recipe[nova::hostname]",
"recipe[nova::source]",
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:source => {
:mysql_password => "secrete",
:rabbit_password => "secrete",
:admin_password => "secrete",
:service_token => "secrete",
:flat_interface => "eth1",
:public_interface => "eth1",
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:host_ip => ip
}
},
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment