designate/contrib/vagrant/Vagrantfile
Kiall Mac Innes 5d0e4da38c Add centos7, remove Fedora Vagrant VM
The Fedora box has not been available in some time, and most Designate
deployments running on RH based distros will be RHEL/CentOS.

Change-Id: I05e34c908ac1d5a7a2037d43f47987cad6c25531
2016-06-07 16:32:18 +01:00

165 lines
5.9 KiB
Ruby

VAGRANTFILE_API_VERSION = "2"
GITCONFIG = `cat $HOME/.gitconfig`
Vagrant.require_version ">= 1.5"
VM_RAM_SIZE = "8192"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.forward_agent = true
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "tcp"
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "udp"
config.vm.provider "virtualbox" do |vb, override|
vb.customize ["modifyvm", :id, "--memory", VM_RAM_SIZE]
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"]
override.vm.synced_folder "../..", "/opt/stack/designate"
if File.directory?("../../../python-designateclient")
override.vm.synced_folder "../../../python-designateclient", "/opt/stack/python-designateclient"
end
if File.directory?("../../../designate-dashboard")
override.vm.synced_folder "../../../designate-dashboard", "/opt/stack/designate-dashboard"
end
if File.directory?("../../../designate-tempest-plugin")
override.vm.synced_folder "../../../designate-tempest-plugin", "/opt/stack/designate-tempest-plugin"
end
if File.directory?("../../../devstack")
override.vm.synced_folder "../../../devstack", "/home/vagrant/devstack"
end
if File.directory?("../../../grenade")
override.vm.synced_folder "../../../grenade", "/opt/stack/grenade"
end
if File.directory?("../../../tempest")
override.vm.synced_folder "../../../tempest", "/opt/stack/tempest"
end
if File.directory?("../../../rally")
override.vm.synced_folder "../../../rally", "/opt/stack/rally"
end
end
config.vm.provider :libvirt do |lv, override|
lv.graphics_ip = '0.0.0.0'
lv.nested = true
lv.memory = Integer(VM_RAM_SIZE)
if not RUBY_PLATFORM.downcase.include?("mswin")
lv.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
override.vm.synced_folder ".", "/vagrant", type: "nfs"
override.vm.synced_folder "../..", "/opt/stack/designate", type: "nfs"
if File.directory?("../../../python-designateclient")
override.vm.synced_folder "../../../python-designateclient", "/opt/stack/python-designateclient", type: "nfs"
end
if File.directory?("../../../designate-dashboard")
override.vm.synced_folder "../../../designate-dashboard", "/opt/stack/designate-dashboard", type: "nfs"
end
if File.directory?("../../../designate-tempest-plugin")
override.vm.synced_folder "../../../designate-tempest-plugin", "/opt/stack/designate-tempest-plugin", type: "nfs"
end
if File.directory?("../../../grenade")
override.vm.synced_folder "../../../grenade", "/opt/stack/grenade", type: "nfs"
end
if File.directory?("../../../devstack")
override.vm.synced_folder "../../../devstack", "/home/vagrant/devstack", type: "nfs"
end
if File.directory?("../../../tempest")
override.vm.synced_folder "../../../tempest", "/opt/stack/tempest", type: "nfs"
end
if File.directory?("../../../rally")
override.vm.synced_folder "../../../rally", "/opt/stack/rally", type: "nfs"
end
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 local.conf sample
cd /opt/stack/designate/contrib/vagrant
if [ ! -f "/home/vagrant/devstack/local.conf" ]; then
cp local.conf /home/vagrant/devstack/local.conf
fi
# Link in any Rally Plugins
mkdir /home/vagrant/.rally
ln -s /opt/stack/designate/rally-scenarios/plugins /home/vagrant/.rally/plugins
SCRIPT
config.vm.define "ubuntu", primary: true 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 lvm2"
ubuntu.vm.provision :shell, :privileged => false, :inline => $script
end
config.vm.define "ubuntu-wily", autostart: false do |ubuntu|
ubuntu.vm.box = "ubuntu/wily64"
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 lvm2"
ubuntu.vm.provision :shell, :privileged => false, :inline => $script
end
config.vm.define "ubuntu-xenial", autostart: false do |ubuntu|
ubuntu.vm.box = "ubuntu/xenial64"
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 lvm2"
ubuntu.vm.provision :shell, :privileged => false, :inline => $script
end
config.vm.define "centos-7", autostart: false do |centos|
centos.vm.box = "centos/7"
centos.vm.network :private_network, ip: "192.168.27.101"
centos.vm.provision :shell, :privileged => true, :inline => "yum update -y vim-minimal" # RH Bug 1066983
centos.vm.provision :shell, :privileged => true, :inline => "yum install -y git-core"
centos.vm.provision :shell, :privileged => false, :inline => $script
end
end