Update Vagrantfile to include CentOS7

Change-Id: I5c8a3b64903bfac657e445eeb5895bda35f33b50
This commit is contained in:
Jesse Pretorius 2017-03-23 13:34:36 +00:00
parent 2feef333ca
commit 24d52d5b01

146
Vagrantfile vendored
View File

@ -1,52 +1,116 @@
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |v|
v.name = "OpenStack-Ansible_#{Time.now.getutc.to_i}" config.vm.define "ubuntu1604" do |xenial|
v.memory = 8192 xenial.vm.box = "ubuntu/xenial64"
v.cpus = 4 xenial.vm.provider "virtualbox" do |v|
image_path = "#{ENV["HOME"]}/VirtualBox VMs/#{v.name}" v.name = "OpenStack-Ansible_Ubuntu-16.04_#{Time.now.getutc.to_i}"
image_name = 'ubuntu-xenial-16.04-cloudimg' v.memory = 8192
v.cpus = 4
# We clone the image to a resizable format image_path = "#{ENV["HOME"]}/VirtualBox VMs/#{v.name}"
v.customize [ image_name = 'ubuntu-xenial-16.04-cloudimg'
"clonehd", "#{image_path}/#{image_name}.vmdk",
"#{image_path}/#{image_name}.vdi",
"--format", "VDI"
]
# Then resize it to 60 GB # We clone the image to a resizable format
v.customize [ v.customize [
"modifymedium", "disk", "clonehd", "#{image_path}/#{image_name}.vmdk",
"#{image_path}/#{image_name}.vdi", "#{image_path}/#{image_name}.vdi",
"--resize", 60 * 1024 "--format", "VDI"
] ]
# Then attach it as the primary disk # Then resize it to 60 GB
v.customize [ v.customize [
"storageattach", :id, "modifymedium", "disk",
"--storagectl", "SCSI Controller", "#{image_path}/#{image_name}.vdi",
"--port", "0", "--resize", 60 * 1024
"--device", "0", ]
"--type", "hdd",
"--nonrotational", "on",
"--medium", "#{image_path}/#{image_name}.vdi"
]
# Then remove the original disk # Then attach it as the primary disk
v.customize [ v.customize [
"closemedium", "disk", "storageattach", :id,
"#{image_path}/#{image_name}.vmdk", "--storagectl", "SCSI Controller",
"--delete" "--port", "0",
] "--device", "0",
"--type", "hdd",
"--nonrotational", "on",
"--medium", "#{image_path}/#{image_name}.vdi"
]
# Now we can execute the build # Then remove the original disk
config.vm.provision "shell", inline: <<-SHELL v.customize [
sudo su - "closemedium", "disk",
cd /vagrant "#{image_path}/#{image_name}.vmdk",
./scripts/gate-check-commit.sh "--delete"
SHELL ]
# Now we can execute the build
config.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./scripts/gate-check-commit.sh
SHELL
end
end end
config.vm.define "centos7" do |centos7|
centos7.vm.box = "centos/7"
centos7.vm.provider "virtualbox" do |v|
v.name = "OpenStack-Ansible_CentOS-7_#{Time.now.getutc.to_i}"
v.memory = 8192
v.cpus = 4
image_path = "#{ENV["HOME"]}/VirtualBox VMs/#{v.name}"
image_name = 'centos-7-1-1.x86_64'
# We clone the image to a resizable format
v.customize [
"clonehd", "#{image_path}/#{image_name}.vmdk",
"#{image_path}/#{image_name}.vdi",
"--format", "VDI"
]
# Then resize it to 60 GB
v.customize [
"modifymedium", "disk",
"#{image_path}/#{image_name}.vdi",
"--resize", 60 * 1024
]
# Then attach it as the primary disk
v.customize [
"storageattach", :id,
"--storagectl", "IDE Controller",
"--port", "0",
"--device", "0",
"--type", "hdd",
"--nonrotational", "on",
"--medium", "#{image_path}/#{image_name}.vdi"
]
# Then remove the original disk
v.customize [
"closemedium", "disk",
"#{image_path}/#{image_name}.vmdk",
"--delete"
]
# Now we can execute the build
config.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
PART_START=$(parted /dev/sda --script unit MB print | awk '/^ 3 / {print $3}')
parted /dev/sda --script unit MB mkpart primary ${PART_START} 100%
parted /dev/sda --script set 4 lvm on
pvcreate /dev/sda4
vgextend VolGroup00 /dev/sda4
lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00
xfs_growfs /dev/mapper/VolGroup00-LogVol00
./scripts/gate-check-commit.sh
SHELL
end
end
end end