designate/contrib/vagrant/Vagrantfile
Kiall Mac Innes 270ad8a2fd Update Vagrantfile with new Ubuntu box
rhefner/devstack-dependencies no longer exists (Download fails with
a 401), so we switch over to ubuntu/trusty64.

Change-Id: Ibcfb028af22a0f6446948f770be7af1b8663b90e
2015-01-14 10:21:17 -08:00

104 lines
3.3 KiB
Ruby

VAGRANTFILE_API_VERSION = "2"
GITCONFIG = `cat $HOME/.gitconfig`
Vagrant.require_version ">= 1.5"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.forward_agent = true
config.vm.synced_folder "../..", "/opt/stack/designate"
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "tcp"
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "udp"
if File.directory?("../../../python-designateclient")
config.vm.synced_folder "../../../python-designateclient", "/opt/stack/python-designateclient"
end
if File.directory?("../../../../stackforge/rally")
config.vm.synced_folder "../../../../stackforge/rally", "/opt/stack/rally"
end
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
if not RUBY_PLATFORM.downcase.include?("mswin")
vb.customize ["modifyvm", :id, "--cpus", `awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' `.chomp ]
end
vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
end
$script = <<SCRIPT
set -e
# Fixup permissions on /opt/stack/
sudo chown vagrant:vagrant /opt/stack/
# Copy over git config
cat << EOF > /home/vagrant/.gitconfig
#{GITCONFIG}
EOF
# Clone DevStack
if [ ! -d "/home/vagrant/devstack" ]; then
git clone https://git.openstack.org/openstack-dev/devstack.git /home/vagrant/devstack
fi
# Install Vagrant localrc sample
cd /opt/stack/designate/contrib/vagrant
if [ ! -f "/home/vagrant/devstack/localrc" ]; then
cp localrc /home/vagrant/devstack/localrc
fi
# Install Designate DevStack extension
cd /opt/stack/designate/contrib/devstack
for f in lib/* extras.d/* exercises/*; do
if [ ! -f "/home/vagrant/devstack/$f" ]; then
ln -fs /opt/stack/designate/contrib/devstack/$f -t /home/vagrant/devstack/$(dirname $f)
fi
done
# Clone Rally
if [ ! -d "/opt/stack/rally" ]; then
git clone https://git.openstack.org/stackforge/rally.git /opt/stack/rally
fi
# Install Rally DevStack extension
cd /opt/stack/rally/contrib/devstack
for f in lib/* extras.d/*; do
if [ ! -f "/home/vagrant/devstack/$f" ]; then
ln -fs /opt/stack/rally/contrib/devstack/$f -t /home/vagrant/devstack/$(dirname $f)
fi
done
# Link in the Rally Plugins
mkdir /home/vagrant/.rally
ln -s /opt/stack/designate/rally-scenarios/plugins /home/vagrant/.rally/plugins
SCRIPT
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu/trusty64"
ubuntu.vm.network :private_network, ip: "192.168.27.100"
ubuntu.vm.provision :shell, :privileged => true, :inline => "DEBIAN_FRONTEND=noninteractive apt-get update"
ubuntu.vm.provision :shell, :privileged => true, :inline => "DEBIAN_FRONTEND=noninteractive apt-get install --yes git"
ubuntu.vm.provision :shell, :privileged => false, :inline => $script
end
config.vm.define "fedora" do |fedora|
fedora.vm.box = "box-cutter/fedora20"
fedora.vm.network :private_network, ip: "192.168.27.101"
fedora.vm.provision :shell, :privileged => true, :inline => "yum update -y vim-minimal" # RH Bug 1066983
fedora.vm.provision :shell, :privileged => true, :inline => "yum install -y git-core MySQL-python"
fedora.vm.provision :shell, :privileged => false, :inline => $script
end
end