From: Andrew Grimberg Date: Tue, 24 Nov 2015 19:56:29 +0000 (-0800) Subject: Initial build environment vagrant configuration X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=906eba932b9f097cc91319071bcde92f1c03701f;p=ci-management.git Initial build environment vagrant configuration This is the initial load in of the Vagrantfile used to create the build environment for Jenkins. More work should be done to break apart the current inline shell script with external scripts so that it will be easier to pick and choose what is to be run and that way the community can share a single script Change-Id: Ied7f9e29c4f20628aff3eae29335ad13f385139f Signed-off-by: Andrew Grimberg --- diff --git a/vagrant/basebuild/Vagrantfile b/vagrant/basebuild/Vagrantfile new file mode 100644 index 000000000..df63f33ec --- /dev/null +++ b/vagrant/basebuild/Vagrantfile @@ -0,0 +1,78 @@ +# -*- mode: ruby -*- +# vi: set ts=2 sw=2 sts=2 et ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "ubuntu/trusty64" + +# config.vm.network "private_network", type: "dhcp" + + config.vm.provider "virtualbox" do |vb| + vb.memory = "4096" + end + config.vm.provider "vmware_fusion" do |fusion,override| + override.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" + fusion.vmx["memsize"] = "4096" + end + config.vm.provider "vmware_workstation" do |vws,override| + override.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" + vws.vmx["memsize"] = "8192" + vws.vmx["numvcpus"] = "4" +# To enable workstation GUI +# vws.gui = "true" + end + + config.vm.provider :openstack do |os, override| + override.vm.box = 'dummy' + os.image = 'Ubuntu 14.04 LTS (2015-11-19) - Agentless' + config.ssh.username = 'ubuntu' + end + + config.vm.provision "shell", inline: <<-SHELL + + # Standard update + upgrade dance + apt-get update + apt-get upgrade -y + + # Fix the silly notion that /bin/sh should point to dash by pointing it to bash + + sudo update-alternatives --install /bin/sh sh /bin/bash 100 + + # Install build tools + apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git + + # Install other stuff + # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils + + # Install uio + apt-get install -y linux-image-extra-`uname -r` + + # Install jdk and maven + apt-get install -y openjdk-7-jdk + # $$$ comment out for the moment + # apt-get install -y --force-yes maven3 + + # Load the uio kernel module + modprobe uio_pci_generic + + # Make sure uio loads at boot time + echo uio_pci_generic >> /etc/modules + + # Setup for hugepages using upstart so it persists across reboots + sysctl -w vm.nr_hugepages=1024 + mkdir -p /mnt/huge + echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab + mount /mnt/huge + + SHELL + + ################# + # FINAL CLEANUP # + ################# + + # set RESEAL to... anything if you want to snap an image of this box + # not setting the environment variable will cause the system to come + # up fully and not be in a resealable state + if ENV['RESEAL'] + config.vm.provision 'shell', path: '../lib/system_reseal.sh' + end +end diff --git a/vagrant/lib/system_reseal.sh b/vagrant/lib/system_reseal.sh new file mode 100644 index 000000000..32dbc44d2 --- /dev/null +++ b/vagrant/lib/system_reseal.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# vim: sw=2 ts=2 sts=2 et : + +if [ -f /.autorelabel ]; then + echo "**********************************************" + echo "* SYSTEM REQUIRES RELABELING SKIPPING RESEAL *" + echo "* PLEASE RESTART SYSTEM AND RERUN *" + echo "* PROVISIONING SCRIPTS *" + echo "**********************************************" + exit 1; +fi + +# clean-up from any prior cloud-init networking +#rm -rf /etc/sysconfig/network-scripts/ifcfg-eth* + +rm -rf /etc/Pegasus/*.cnf /etc/Pegasus/*.crt /etc/Pegasus/*.csr /etc/Pegasus/*.pem /etc/Pegasus/*.srl /root/anaconda-ks.cfg /root/anaconda-post.log /root/initial-setup-ks.cfg /root/install.log /root/install.log.syslog /var/cache/fontconfig/* /var/cache/gdm/* /var/cache/man/* /var/lib/AccountService/users/* /var/lib/fprint/* /var/lib/logrotate.status /var/log/*.log* /var/log/BackupPC/LOG /var/log/ConsoleKit/* /var/log/anaconda.syslog /var/log/anaconda/* /var/log/apache2/*_log /var/log/apache2/*_log-* /var/log/apt/* /var/log/aptitude* /var/log/audit/* /var/log/btmp* /var/log/ceph/*.log /var/log/chrony/*.log /var/log/cron* /var/log/cups/*_log /var/log/debug* /var/log/dmesg* /var/log/exim4/* /var/log/faillog* /var/log/gdm/* /var/log/glusterfs/*glusterd.vol.log /var/log/glusterfs/glusterfs.log /var/log/httpd/*log /var/log/installer/* /var/log/jetty/jetty-console.log /var/log/journal/* /var/log/lastlog* /var/log/libvirt/libvirtd.log /var/log/libvirt/lxc/*.log /var/log/libvirt/qemu/*.log /var/log/libvirt/uml/*.log /var/log/lightdm/* /var/log/mail/* /var/log/maillog* /var/log/messages* /var/log/ntp /var/log/ntpstats/* /var/log/ppp/connect-errors /var/log/rhsm/* /var/log/sa/* /var/log/secure* /var/log/setroubleshoot/*.log /var/log/spooler* /var/log/squid/*.log /var/log/syslog* /var/log/tallylog* /var/log/tuned/tuned.log /var/log/wtmp* /var/named/data/named.run + +rm -rf ~/.viminfo /etc/ssh/ssh*key* ~/.ssh/* /root/.ssh/* + +# kill any cloud-init related bits +rm -rf /var/lib/cloud/* + +#if [ -e /usr/bin/facter ] +#then +# if [ `/usr/bin/facter operatingsystem` = 'Ubuntu' ] +# then +# rm -rf /etc/hostname* /etc/hosts /etc/network/interfaces /etc/network/interfaces.*.bak~ +# cat <> /etc/network/interfaces +## Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or +## /usr/share/doc/ifupdown/examples for more information. +## The loopback network interface +#auto lo +#iface lo inet loopback +#EOINT +# fi +#fi + +# cleanup /vagrant +rm -rf /vagrant + +echo "********************************************" +echo "* PLEASE SNAPSHOT IMAGE AT THIS TIME *" +echo "********************************************"