-
-
Save patux/3409560 to your computer and use it in GitHub Desktop.
Vagrant script for devstack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APT::Cache-Limit "800000000"; | |
APT::Cache-Start "600000000"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! $1 ]; then | |
swapsize=500 | |
else | |
swapsize=$1 | |
fi | |
if [ -a /swapfile ]; then | |
swapoff /swapfile | |
fi | |
#Swapsize is in Mb | |
/bin/dd if=/dev/zero of=/swapfile bs=1M count=$swapsize | |
/sbin/mkswap /swapfile | |
/sbin/swapon /swapfile | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
sshdir = "#{ENV['HOME']}/.ssh/" | |
cachedir = (ENV['CACHEDIR'] or "#{ENV['HOME']}/cache/") | |
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks") | |
ip_prefix = (ENV['IP_PREFIX'] or "192.168.2.") | |
mac_prefix = (ENV['MAC_PREFIX'] or "080027027") | |
suffix = "100" | |
ip = "#{ip_prefix}#{suffix}" | |
config.vm.box = "precise32" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
config.vm.customize ["modifyvm", :id, "--memory", 1024] | |
config.vm.forward_port 80, 8080 | |
config.vm.forward_port 8000, 8001 | |
config.vm.network :hostonly, ip, :mac => "#{mac_prefix}#{suffix}" | |
#config.vm.share_folder("v-cache", "/home/vagrant/cache", cachedir, :nfs => true) | |
#config.vm.share_folder("v-cache", "/home/vagrant/cache", cachedir) | |
config.vm.share_folder("v-apt", "/var/cache/apt", "#{cachedir}/aptcache/") | |
#config.vm.share_folder "v-data", "/data", cachedir | |
config.vm.share_folder("v-ssh", "/home/vagrant/.host-ssh", sshdir) | |
config.vm.provision :puppet do |puppet| | |
puppet.manifests_path = "puppet/manifests" | |
puppet.module_path = "puppet/modules" | |
puppet.manifest_file = "init.pp" | |
end | |
config.vm.provision :chef_solo do |chef| | |
chef.cookbooks_path = "#{checkout}/cookbooks" | |
chef.roles_path = "#{checkout}/roles" | |
#chef.log_level = :debug | |
chef.run_list = [ | |
# nfs does not work on windows, so I have to disable this option | |
# shared filesystems does not work as we would like on windows systems | |
#"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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node default { | |
class { 'swapfile': swapsize => 500 } | |
include apt-cache | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class apt-cache { | |
file { | |
"apt-cachelimit": | |
ensure => file, | |
path => '/etc/apt/apt.conf.d/11cache', | |
mode => "0644", | |
owner => 'root', | |
group => 'root', | |
source => "puppet:///modules/apt-cache/11cache", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class swapfile ( $swapsize = '500' ) { | |
exec { "/tmp/create-swap.sh $swapsize": | |
cwd => "/tmp/", | |
creates => "/swapfile", | |
path => ["/usr/bin", "/usr/sbin"], | |
require =>File['createswapscript'], | |
} | |
file { | |
"createswapscript": | |
ensure => file, | |
path => '/tmp/create-swap.sh', | |
mode => "0744", | |
owner => 'root', | |
group => 'root', | |
source => "puppet:///modules/swapfile/create-swap.sh", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 new vagrant | |
sudo gem install vagrant | |
# get chef scripts | |
git clone git://github.com/cloudbuilders/openstack-cookbooks ~/openstack-cookbooks | |
mkdir ~/cache | |
mkdir ~/cache/stack # git repos are cloned here and shared via nfs | |
mkdir ~/devstack | |
cd ~/devstack | |
curl -o Vagrantfile https://raw.github.com/gist/1297044/devstack.rb | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment