Initial Vagrant configurations 73/12373/1
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Thu, 30 Oct 2014 02:15:22 +0000 (19:15 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Thu, 30 Oct 2014 02:15:22 +0000 (19:15 -0700)
Add two vagrant configurations.

* rackspace-convert-base - used for taking a Rackspace base image and
  prepping it for use with other Vagrant definitions

* ovsdb-devstack - the current definition used for the OVSDB projects'
  DevStack testing dynamic slave. Please note that while this was used
  in the creation of the image used by OVSDB it was not the final
  vagrant. The Linux Foundation has an additional overlay that it uses
  to configure networking needs for the Rackspace private network that
  they operating the build environment inside of. As this extra overlay
  includes private configuration data it is not being added to the
  repository.

Change-Id: I800a096042ef196efceae6f2f19db754728415ee
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
vagrant/ovsdb-devstack/README.md [new file with mode: 0644]
vagrant/ovsdb-devstack/Vagrantfile [new file with mode: 0644]
vagrant/ovsdb-devstack/bootstrap.sh [new file with mode: 0644]
vagrant/ovsdb-devstack/system_reseal.sh [new file with mode: 0644]
vagrant/rackspace-convert-base/README.md [new file with mode: 0644]
vagrant/rackspace-convert-base/Vagrantfile [new file with mode: 0644]
vagrant/rackspace-convert-base/bootstrap.sh [new file with mode: 0644]
vagrant/rackspace-convert-base/remove_requiretty.sh [new file with mode: 0644]
vagrant/rackspace-convert-base/system_reseal.sh [new file with mode: 0644]

diff --git a/vagrant/ovsdb-devstack/README.md b/vagrant/ovsdb-devstack/README.md
new file mode 100644 (file)
index 0000000..70db039
--- /dev/null
@@ -0,0 +1,22 @@
+ovsdb-devstack can be used to take an already converted Rackspace native
+base image into a usuable DevStack base image for ODL DevStack testing.
+
+Please see the rackspace-convert-base vagrant setup for creation of the
+needed base image.
+
+This vagrant expects (by default) a personal image named
+
+'Fedora 20 (Heisenbug) - Vagrant ready'
+
+To spin up and utilize.
+
+$ RSIMAGE='${baseimage_name}' vagrant up --provider=rackspace
+
+Will execute this vagrant against a differently named base image
+
+$ RSRESEAL=true vagrant up --provider=rackspace
+
+NOTE: resealing will cause the vagrant to run the resealing operation.
+This operation will intentionally destroy current SSH pubkeys installed
+on the system as well as reset log files and network configurations. You
+have been warned.
diff --git a/vagrant/ovsdb-devstack/Vagrantfile b/vagrant/ovsdb-devstack/Vagrantfile
new file mode 100644 (file)
index 0000000..2a3ae7d
--- /dev/null
@@ -0,0 +1,55 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby sw=2 ts=2 sts=2 et :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  # root off of the rackspace provider dummy box
+  config.vm.box = "dummy"
+
+  # rackspace systems, even with cloud-init
+  # don't seem to have the cloud int user ${osname} (or similar)
+  # getting the ssh key for some reason, root does for sure
+  # so use that
+  config.ssh.username = 'root'
+
+  # Fedora and EL systems default to requiring tty for sudo
+  # This should have been disabled with the Vagrant ready
+  # base box conversion (see rackspace-convert-base vagrant)
+  # but just to be safe
+  config.ssh.pty = true
+
+  # make sure to set the following in your
+  # ~/.vagrant.d/boxes/dummy/0/rackspace/Vagrantfile
+  # rs.username
+  # rs.api_key
+  # rs.rackspace_region
+  #
+  # If you are not using an SSH token / smartcard also set this
+  # rs.key_name
+  # config.ssh.private_key_path -- set this outside the rackspace block
+  #         in your base box
+  config.vm.provider :rackspace do |rs|
+    # create these base builds always on the smallest system possible
+    rs.flavor = 'performance1-1'
+
+    # Default the Fedora 20 Vagrant ready image unless overriden by a RSIMAGE
+    # environment variable
+    if ENV['RSIMAGE']
+      rs.image = ENV['RSIMAGE']
+    else
+      rs.image = 'Fedora 20 (Heisenbug) - Vagrant ready'
+    end
+  end
+
+  # run our bootstrapping for the ovsdb-devstack system
+  config.vm.provision 'shell', path: 'bootstrap.sh'
+
+  # set RSRESEAL 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['RSRESEAL']
+    config.vm.provision 'shell', path: 'system_reseal.sh'
+  end
+end
diff --git a/vagrant/ovsdb-devstack/bootstrap.sh b/vagrant/ovsdb-devstack/bootstrap.sh
new file mode 100644 (file)
index 0000000..47e2af6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# enable enforcing mode from the very start
+setenforce enforcing
+
+# configure system for enforcing mode on next boot
+sed -i 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config
+
+yum clean all
+yum update -y
+yum install -q -y deltarpm python python-crypto python-devel python-lxml python-setuptools @development-tools libxml2-devel libxslt-devel libffi-devel
+yum install -q -y java git sudo openssl-devel
+
+if [ ! -f /etc/udev/rules.d/80-net-setup-link.rules ]; then
+    ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
+fi
+
+echo "***************************************************"
+echo "*   PLEASE RELOAD THIS VAGRANT BOX BEFORE USE     *"
+echo "***************************************************"
diff --git a/vagrant/ovsdb-devstack/system_reseal.sh b/vagrant/ovsdb-devstack/system_reseal.sh
new file mode 100644 (file)
index 0000000..ba54ce2
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# clean-up from any prior cloud-init networking
+rm -rf /etc/sysconfig/network-scripts/{ifcfg,route}-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*
+
+echo "********************************************"
+echo "*   PLEASE SNAPSHOT IMAGE AT THIS TIME     *"
+echo "********************************************"
diff --git a/vagrant/rackspace-convert-base/README.md b/vagrant/rackspace-convert-base/README.md
new file mode 100644 (file)
index 0000000..974f5be
--- /dev/null
@@ -0,0 +1,26 @@
+rackspace-convert-base can be used to convert a RackSpace native base
+image into a Vagrant compatible one. The default image to convert is the
+'Fedora 20 (Heisenbug) (PVHVM)' image but this can be overridden just by
+setting the RSIMAGE environment variable before calling the vagrant up.
+
+ex:
+
+$ RSIMAGE='CentOS 7 (PVHVM)' vagrant up --provider=rackspace
+
+This vagrant will just set the instance up at the most basic to be
+Vagrant capable and also SELinux enforcing. It will then "reseal" itself
+and state the the system is ready for imaging. Any further RackSpace
+specific Vagrant definitions will expect a base system of the form
+"$DISTRO - Vagrant ready" for the base image name
+
+ex:
+
+Fedora 20 (Heisenbug) - Vagrant ready
+
+or
+
+CentOS 7 - Vagrant ready
+
+NOTE: The reseal operation _destroys_ the SSH keys that were used to
+bring the Vagrant system up effectively making the system unable to
+perform SSH based logins again. This is intentional.
diff --git a/vagrant/rackspace-convert-base/Vagrantfile b/vagrant/rackspace-convert-base/Vagrantfile
new file mode 100644 (file)
index 0000000..9581545
--- /dev/null
@@ -0,0 +1,62 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby sw=2 ts=2 sts=2 et :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  # root off of the rackspace provider dummy box
+  config.vm.box = "dummy"
+
+  # rackspace systems even with cloud-init
+  # don't seem to have the cloud init user ${osname}
+  # getting the ssh key for some reason, root does
+  # so use that
+  config.ssh.username = 'root'
+  
+  # Fedora and EL systems default to requiring a tty for sudo
+  config.ssh.pty = true
+
+  # The rackspace provider by default tries to rsync
+  # the local folder / vagrant box to /vagrant
+  # unfortunately, even with config.ssh.pty = true
+  # this fails because it doesn't recognize the pty requirement
+  # when doing the sudo based rsync (not that it needs to sudo
+  # when doing things as root). To avoid this, disable the
+  # default sync, we don't need it anyway.
+  config.vm.synced_folder '.', '/vagrant', :disabled => true
+
+  # make sure to set the following in your
+  # ~/.vagrant.d/boxes/dummy/0/rackspace/Vagrantfile
+  # rs.username
+  # rs.api_key
+  # rs.rackspace_region
+  #
+  # If you are not using a SSH token / smartcard also set this
+  # rs.key_name
+  # config.ssh.private_key_path  -- set this outside the rackspace block
+  #         in your base box
+  config.vm.provider :rackspace do |rs|
+    # create these base builds always on the smallest system possible
+    rs.flavor = 'performance1-1'
+
+    # Default to the Fedora 20 image unless overridden by a RSIMAGE
+    # environment variable
+    if ENV['RSIMAGE']
+      rs.image = ENV['RSIMAGE']
+    else
+      rs.image = 'Fedora 20 (Heisenbug) (PVHVM)'
+    end
+  end
+
+  # disable the default requiretty for sudo that Fedora and CentOS have
+  config.vm.provision 'shell', path: 'remove_requiretty.sh'
+
+  # Do a full system update and force enforcing on (it's in permissive
+  # by default in the rackspace base images)
+  config.vm.provision 'shell', path: 'bootstrap.sh'
+
+  # Execute a system clean-up in prep for imaging so that this base
+  # image can be used for other Rackspace Vagrant configurations
+  config.vm.provision 'shell', path: 'system_reseal.sh'
+end
diff --git a/vagrant/rackspace-convert-base/bootstrap.sh b/vagrant/rackspace-convert-base/bootstrap.sh
new file mode 100644 (file)
index 0000000..76c3d68
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# enable enforcing mode from the very start
+setenforce enforcing
+
+# configure system for enforcing mode on next boot
+sed -i 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config
+
+yum clean all
+yum update -y
diff --git a/vagrant/rackspace-convert-base/remove_requiretty.sh b/vagrant/rackspace-convert-base/remove_requiretty.sh
new file mode 100644 (file)
index 0000000..a624cac
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+/bin/sed -i 's/requiretty/!requiretty/' /etc/sudoers;
diff --git a/vagrant/rackspace-convert-base/system_reseal.sh b/vagrant/rackspace-convert-base/system_reseal.sh
new file mode 100644 (file)
index 0000000..ba54ce2
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# clean-up from any prior cloud-init networking
+rm -rf /etc/sysconfig/network-scripts/{ifcfg,route}-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*
+
+echo "********************************************"
+echo "*   PLEASE SNAPSHOT IMAGE AT THIS TIME     *"
+echo "********************************************"