Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.anso.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
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[apt]",
#"recipe[apt::cacher]",
"recipe[chef::bootstrap_server]",
"recipe[anso::cookbooks]",
"recipe[nginx]",
"recipe[anso::tty]",
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
},
:chef => {
:server_url => "http://localhost:4000",
:webui_enabled => true,
},
:cookbooks => {
:branch => "devpackages"
},
})
end
end
global_config.vm.define :head do |config|
suffix = "101"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
config.vm.provision :chef_server do |chef|
chef.chef_server_url = "http://#{ip_prefix}100:4000"
chef.validation_key_path = "vagrant.pem"
chef.validation_client_name = "vagrant"
chef.node_name = "nova-head-vagrant"
chef.provisioning_path = "/etc/chef"
chef.log_level = :debug
chef.run_list = [
"recipe[nova::hostname]",
#"recipe[anso::apt_proxy]",
"recipe[anso::devpackages]",
"recipe[nova::mysql]",
"recipe[nova::rabbit]",
"recipe[nova::api]",
"recipe[nova::scheduler]",
"recipe[nova::network]",
"recipe[nova::objectstore]",
"recipe[nova::setup]",
"recipe[nova::dashboard]",
"recipe[nova::creds]", # put creds for admin user
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:fixed_range => fixed,
:flat_dhcp_start => (fixed.split('.')[0..2].join('.') + ".2"),
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:public_interface => "br100",
:images => [
"http://#{ip_prefix}100/tty.tgz"
],
:creds => {
:user => "vagrant",
:group => "vagrant",
:dir => "/vagrant",
}
},
:apt => {
:distro => "maverick",
:proxy_url => "http://#{ip_prefix}100:3142",
}
})
end
end
global_config.vm.define :node do |config|
suffix = "102"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
config.vm.provision :chef_server do |chef|
chef.chef_server_url = "http://#{ip_prefix}100:4000"
# This needs to be set to the validator
chef.validation_key_path = "vagrant.pem"
chef.validation_client_name = "vagrant"
chef.node_name = "nova-node-vagrant"
chef.provisioning_path = "/etc/chef"
chef.log_level = :debug
chef.run_list = [
"recipe[nova::hostname]",
#"recipe[anso::apt_proxy]",
"recipe[anso::devpackages]",
"recipe[nova::filevg]",
"recipe[nova::volume]",
"recipe[nova::compute]",
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:libvirt_type => "qemu",
},
:apt => {
:distro => "maverick",
:proxy_url => "http://#{ip_prefix}100:3142",
}
})
end
end
end
Vagrant::Config.run do |config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.86.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027086")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
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[nova::hostname]",
"recipe[anso::devpackages]",
"recipe[nova::filevg]",
"recipe[nova]", # shortcut for nova::all + nova::setup
"recipe[nova::creds]", # put creds for admin user
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:flatdhcp => false,
:fixed_range => (ENV['FIXED'] or "10.0.86.0/24"),
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:libvirt_type => "qemu",
:images => [
"http://images.ansolabs.com/tty.tgz"
],
:creds => {
:user => "vagrant",
:group => "vagrant",
:dir => "/vagrant",
}
},
})
end
end
curl -O https://github.com/vishvananda/novascript/raw/master/nova.sh
chmod 755 nova.sh
./nova.sh branch
./nova.sh install
sudo ./nova.sh run
# shutdown your old machines
# install new virtualbox
# os x
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
# maverick
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb http://download.virtualbox.org/virtualbox/debian maverick contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install -y virtualbox-4.0
# lucid
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb http://download.virtualbox.org/virtualbox/debian lucid contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install -y virtualbox-4.0
# install new vagrant
# os x
sudo gem install vagrant
# maverick
sudo gem install vagrant
sudo ln -s /var/lib/gems/1.8/bin/vagrant /usr/local/bin/vagrant
# lucid
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.zip
sudo apt-get install -y unzip
unzip rubygems-1.3.6.zip
cd rubygems-1.3.6
sudo ruby setup.rb
sudo gem1.8 install vagrant
git clone git://github.com/ansolabs/openstack-cookbooks ~/openstack-cookbooks
mkdir ~/aptcache
mkdir ~/chef
cd ~/chef
# solo version
curl -o Vagrantfile https://gist.github.com/raw/786945/solo.rb
vagrant up
# server version
# curl -o Vagrantfile https://gist.github.com/raw/786945/server.rb
# the chef server takes two runs to provision properly
# vagrant up chef; vagrant provision chef; vagrant up
# if you want to hit the instances you can
# os x
route add -net 10.0.0.0/8 192.168.76.12 # or .112 for server version
# linux
route add -net 10.0.0.0/8 gw 192.168.76.12 # or .112 for server version
# to run smoketests, make sure you have eucatools
. novarc
euca-authorize -P icmp -t -1:-1 default
euca-authorize -P tcp -p 22 default
# run smoketests with --nouse_ipv6
cd /path/to/trunk_safe/smoketests && python user_smoketests.py --nouse_ipv6; cd -
# cleanup when you are done
# os x
route delete -net 10.0.0.0/8 192.168.76.12
# linux
route delete -net 10.0.0.0/8 gw 192.168.76.12
rm .pem novarc
vagrant destroy
# if you want to use the devpackages:
cd ~/openstack-cookbooks/; git checkout devpackages; cd -
sed -i s/packages/devpackages/ Vagrantfile
sed -i s/master/devpackages/ Vagrantfile
Vagrant::Config.run do |global_config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.76.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027076")
fixed = (ENV['FIXED'] or "10.0.76.0/24")
global_config.vm.define :chef do |config|
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.anso.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
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[apt]",
#"recipe[apt::cacher]",
"recipe[chef::bootstrap_server]",
"recipe[anso::cookbooks]",
"recipe[nginx]",
"recipe[anso::tty]",
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
},
:chef => {
:server_url => "http://localhost:4000",
:webui_enabled => true,
},
:cookbooks => {
:branch => "master"
},
})
end
end
global_config.vm.define :head do |config|
suffix = "101"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
config.vm.provision :chef_server do |chef|
chef.chef_server_url = "http://#{ip_prefix}100:4000"
chef.validation_key_path = "vagrant.pem"
chef.validation_client_name = "vagrant"
chef.node_name = "nova-head-vagrant"
chef.provisioning_path = "/etc/chef"
chef.log_level = :debug
chef.run_list = [
"recipe[nova::hostname]",
#"recipe[anso::apt_proxy]",
"recipe[anso::packages]",
"recipe[nova::mysql]",
"recipe[nova::rabbit]",
"recipe[nova::api]",
"recipe[nova::scheduler]",
"recipe[nova::network]",
"recipe[nova::objectstore]",
"recipe[nova::setup]",
"recipe[nova::dashboard]",
"recipe[nova::creds]", # put creds for admin user
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:fixed_range => fixed,
:flat_dhcp_start => (fixed.split('.')[0..2].join('.') + ".2"),
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:public_interface => "br100",
:images => [
"http://#{ip_prefix}100/tty.tgz"
],
:creds => {
:user => "vagrant",
:group => "vagrant",
:dir => "/vagrant",
}
},
:apt => {
:distro => "maverick",
:proxy_url => "http://#{ip_prefix}100:3142",
}
})
end
end
global_config.vm.define :node do |config|
suffix = "102"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
config.vm.provision :chef_server do |chef|
chef.chef_server_url = "http://#{ip_prefix}100:4000"
# This needs to be set to the validator
chef.validation_key_path = "vagrant.pem"
chef.validation_client_name = "vagrant"
chef.node_name = "nova-node-vagrant"
chef.provisioning_path = "/etc/chef"
chef.log_level = :debug
chef.run_list = [
"recipe[nova::hostname]",
#"recipe[anso::apt_proxy]",
"recipe[anso::packages]",
"recipe[nova::filevg]",
"recipe[nova::volume]",
"recipe[nova::compute]",
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:libvirt_type => "qemu",
},
:apt => {
:distro => "maverick",
:proxy_url => "http://#{ip_prefix}100:3142",
}
})
end
end
end
#!/usr/bin/env bash
SMOKETESTS=${1:-$HOME/trunk_safe/smoketests}
VAGRANT=${VAGRANT:-$HOME/chef-solo}
RC=${RC:-$VAGRANT/novarc}
export FIXED=${FIXED:-10.0.86.0/24}
export IP_PREFIX=${IP_PREFIX:-192.168.86.}
export MAC_PREFIX=${MAC_PREFIX:-080027086}
cd $VAGRANT
vagrant up
cd -
sleep 10
IP=${IP:-`grep EC2_URL $RC | cut -d"/" -f3 | cut -d":" -f1`}
. $RC
euca-authorize -P icmp -t -1:-1 default
euca-authorize -P tcp -p 22 default
sudo route add -net $FIXED gw $IP
cd $SMOKETESTS
python run_tests.py --with-xunit --xunit-file=$WORKSPACE/nosetests.xml
cd -
sudo route del -net $FIXED gw $IP
cd $VAGRANT
vagrant destroy
cd -
Vagrant::Config.run do |config|
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.86.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027086")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
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[nova::hostname]",
"recipe[anso::packages]",
"recipe[nova::filevg]",
"recipe[nova]", # shortcut for nova::all + nova::setup
"recipe[nova::creds]", # put creds for admin user
#"recipe[anso::settings]", # vim / screen / git settings for testing
]
chef.json.merge!({
:nova => {
:my_ip => ip,
:flatdhcp => false,
:fixed_range => (ENV['FIXED'] or "10.0.86.0/24"),
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:libvirt_type => "qemu",
:images => [
"http://images.ansolabs.com/tty.tgz"
],
:creds => {
:user => "vagrant",
:group => "vagrant",
:dir => "/vagrant",
}
},
})
end
end
Vagrant::Config.run do |config|
sshdir = "#{ENV['HOME']}/.ssh/"
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
bzrdir = (ENV['BZRDIR'] or "#{ENV['HOME']}/bzr/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.26.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027026")
source_branch = (ENV['SOURCE_BRANCH'] or "lp:nova")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "base"
config.vm.box_url = "http://images.ansolabs.com/vagrant/maverick64.box"
config.vm.customize do |vm|
vm.memory_size = 1024
end
config.vm.network(ip, :mac => "#{mac_prefix}#{suffix}")
config.vm.share_folder("v-apt", "/var/cache/apt", aptdir)
config.vm.share_folder("v-bzr", "/tmp/bzr", bzrdir)
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[nova::hostname]",
"recipe[anso::settings]", # vim / screen / git settings for testing
"recipe[nova::filevg]",
"recipe[nova::novascript]",
]
chef.json.merge!({
:nova => {
:source_branch => source_branch,
:my_ip => ip,
:flatdhcp => false,
:fixed_range => (ENV['FIXED'] or "10.0.26.0/24"),
:floating_range => (ENV['FLOATING'] or "#{ip_prefix}128/28"),
:libvirt_type => "qemu",
:images => [
"http://images.ansolabs.com/tty.tgz"
],
:creds => {
:user => "vagrant",
:group => "vagrant",
:dir => "/vagrant",
}
},
})
end
end
@Dieterbe
Copy link

Dieterbe commented Oct 19, 2012

seems like config.vm.network needs the networktype (with recent versions of vagrant?), i.e. config.vm.network(:hostonly, ip, :mac => "#{mac_prefix}#{suffix}")
another problem is that http://images.ansolabs.com/vagrant no longer exists. are there newer versions of these gists available? thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment