Initial build environment vagrant configuration 05/5/1
authorAndrew Grimberg <[email protected]>
Tue, 24 Nov 2015 19:56:29 +0000 (11:56 -0800)
committerAndrew Grimberg <[email protected]>
Tue, 24 Nov 2015 19:56:29 +0000 (11:56 -0800)
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 <[email protected]>
vagrant/basebuild/Vagrantfile [new file with mode: 0644]
vagrant/lib/system_reseal.sh [new file with mode: 0644]

diff --git a/vagrant/basebuild/Vagrantfile b/vagrant/basebuild/Vagrantfile
new file mode 100644 (file)
index 0000000..df63f33
--- /dev/null
@@ -0,0 +1,78 @@
+# -*- mode: ruby -*-\r
+# vi: set ts=2 sw=2 sts=2 et ft=ruby :\r
+\r
+Vagrant.configure(2) do |config|\r
+   config.vm.box = "ubuntu/trusty64"\r
+\r
+#  config.vm.network "private_network", type: "dhcp"\r
+\r
+  config.vm.provider "virtualbox" do |vb|\r
+    vb.memory = "4096"\r
+  end\r
+  config.vm.provider "vmware_fusion" do |fusion,override|\r
+    override.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"\r
+    fusion.vmx["memsize"] = "4096"\r
+  end\r
+  config.vm.provider "vmware_workstation" do |vws,override|\r
+    override.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"\r
+    vws.vmx["memsize"] = "8192"\r
+    vws.vmx["numvcpus"] = "4"\r
+#   To enable workstation GUI\r
+#   vws.gui = "true"\r
+  end\r
+\r
+  config.vm.provider :openstack do |os, override|\r
+    override.vm.box = 'dummy'\r
+    os.image = 'Ubuntu 14.04 LTS (2015-11-19) - Agentless'\r
+    config.ssh.username = 'ubuntu'\r
+  end\r
+\r
+  config.vm.provision "shell", inline: <<-SHELL\r
+\r
+    # Standard update + upgrade dance\r
+    apt-get update\r
+    apt-get upgrade -y\r
+\r
+    # Fix the silly notion that /bin/sh should point to dash by pointing it to bash\r
+\r
+    sudo update-alternatives --install /bin/sh sh /bin/bash 100\r
+\r
+    # Install build tools\r
+    apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git\r
+\r
+    # Install other stuff\r
+    # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r
+\r
+    # Install uio\r
+    apt-get install -y linux-image-extra-`uname -r`\r
+\r
+    # Install jdk and maven\r
+    apt-get install -y openjdk-7-jdk\r
+    # $$$ comment out for the moment\r
+    # apt-get install -y --force-yes maven3\r
+\r
+    # Load the uio kernel module\r
+    modprobe uio_pci_generic\r
+\r
+    # Make sure uio loads at boot time\r
+    echo uio_pci_generic >> /etc/modules\r
+\r
+    # Setup for hugepages using upstart so it persists across reboots\r
+    sysctl -w vm.nr_hugepages=1024\r
+    mkdir -p /mnt/huge\r
+    echo "hugetlbfs       /mnt/huge  hugetlbfs       defaults        0 0" >> /etc/fstab\r
+    mount /mnt/huge\r
+\r
+  SHELL\r
+\r
+  #################\r
+  # FINAL CLEANUP #\r
+  #################\r
+\r
+  # set RESEAL to... anything if you want to snap an image of this box\r
+  # not setting the environment variable will cause the system to come\r
+  # up fully and not be in a resealable state\r
+  if ENV['RESEAL']\r
+    config.vm.provision 'shell', path: '../lib/system_reseal.sh'\r
+  end\r
+end\r
diff --git a/vagrant/lib/system_reseal.sh b/vagrant/lib/system_reseal.sh
new file mode 100644 (file)
index 0000000..32dbc44
--- /dev/null
@@ -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 <<EOINT >> /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 "********************************************"