From: Andrew Grimberg Date: Wed, 4 May 2016 17:29:43 +0000 (-0700) Subject: Update devstack vagrant definition for private cloud X-Git-Tag: release/beryllium-sr2~13 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=commitdiff_plain;h=c7c346203154d3d3c5822e2f8e4c6bbdf063b3b6 Update devstack vagrant definition for private cloud This should update the ovsdb-devstack vagrant definition for our private cloud. References to Fedora should be scrubbed, but if they aren't it's will likely only be in comments ;) Change-Id: I207adc4d5718bc16df98b2386444ba9701e98d00 Signed-off-by: Andrew Grimberg --- diff --git a/vagrant/ovsdb-devstack/Vagrantfile b/vagrant/ovsdb-devstack/Vagrantfile index 56bfdf6d6..0622a7a78 100644 --- a/vagrant/ovsdb-devstack/Vagrantfile +++ b/vagrant/ovsdb-devstack/Vagrantfile @@ -5,78 +5,81 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # root off of the rackspace provider dummy box + # root off of the openstack 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 + # ~/.vagrant.d/boxes/dummy/0/openstack/Vagrantfile + # + # os.openstack_auth_url + # os.endpoint_type + # os.flavor + # os.tenant_name + # os.username + # os.password + # os.networks # # 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 + # os.key_name + # config.ssh.private_key_path -- set this outside the openstack block # in your base box - config.vm.provider :rackspace do |rs| - # create these base builds always on the smallest system possible - rs.flavor = 'general1-1' - - # allow for switching to ORD cloud but default to DFW - if (ENV['RSREGION'] == 'ord') - rs.rackspace_region = :ord + config.vm.provider :openstack do |os, override| + if ENV['BOX'] + override.vm.box = ENV['BOX'] else - rs.rackspace_region = :dfw + override.vm.box = 'dummy' end + config.ssh.username = 'centos' + os.flavor = 'm1.small' - # Default the Fedora 20 Vagrant ready image unless overriden by a RSIMAGE - # environment variable - if ENV['RSIMAGE'] - rs.image = ENV['RSIMAGE'] + # require an IMAGE to be passed in + # IMAGE must be a human name and not an image ID! + if ENV['IMAGE'] + os.image = ENV['IMAGE'] else - rs.image = 'Fedora 20 - Vagrant ready' + os.image = 'BAD IMAGE' + override.ssh.username = 'baduser' end - end - # Explicitlly set default shared folder and load lib folder - config.vm.synced_folder ".", "/vagrant" - config.vm.synced_folder "../lib/", "/vagrant/lib" + case ENV['IMAGE'] + when /.*ubuntu.*/i + override.ssh.username = 'ubuntu' - # run our bootstrapping for the ovsdb-devstack system - config.vm.provision 'shell', path: 'bootstrap.sh' + when /.*fedora.*/i + override.ssh.username = 'fedora' + # take care of the tty requirement by fedora for sudo + os.user_data = "#!/bin/bash +/bin/sed -i 's/ requiretty/ !requiretty/' /etc/sudoers;" - ################# - # LF NETWORKING # - ################# + when /.*centos.*/i + override.ssh.username = 'centos' - if ENV['LFNETWORK'] - # reconfigure the network setup to support our special private setup - config.vm.provision 'shell', path: '../lib/lf-networking/configure_lf_infra.sh', - args: ENV['RSSUBDOMAIN'] + # take care of the tty requirement by centos for sudo + os.user_data = "#!/bin/bash +/bin/sed -i 's/ requiretty/ !requiretty/' /etc/sudoers;" + end end + # Explicitlly set default shared folder and load lib folder + config.vm.synced_folder ".", "/vagrant" + config.vm.synced_folder "../lib/", "/vagrant/lib" + + # Do a full system update and enable enforcing if needed + config.vm.provision 'shell', path: '../lib/baseline.sh' + + # run our bootstrapping + config.vm.provision 'shell', path: 'bootstrap.sh' ################# # FINAL CLEANUP # ################# - # set RSRESEAL to... anything if you want to snap an image of this box + # 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['RSRESEAL'] + if ENV['RESEAL'] config.vm.provision 'shell', path: '../lib/system_reseal.sh' end end diff --git a/vagrant/ovsdb-devstack/bootstrap.sh b/vagrant/ovsdb-devstack/bootstrap.sh index 839c4500e..06463517d 100644 --- a/vagrant/ovsdb-devstack/bootstrap.sh +++ b/vagrant/ovsdb-devstack/bootstrap.sh @@ -1,26 +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 +echo '---> Installing non-baseline requirements' yum install -q -y deltarpm python{,-{crypto,devel,lxml,setuptools}} \ - @development {lib{xml2,xslt,ffi},openssl}-devel \ - java git sudo - -# figure out what the latest kernel installed is and switch to it -# NOTE: This is done like this becase the Rackspace F20 images are using -# extlinux / syslinux and don't switch to the newest kernel on update -NEWKERNEL=`rpm -qa | grep kernel-3 | sort -r | head -1 | cut -c 8-` -if [ -f /boot/extlinux.conf ]; then - BOOTLABEL=`grep ${NEWKERNEL} /boot/extlinux.conf | grep LABEL | cut -c 7-` - sed -i "s/ONTIMEOUT linux/ONTIMEOUT ${BOOTLABEL}/" /boot/extlinux.conf -fi + @development {lib{xml2,xslt,ffi},openssl}-devel +echo '---> Updating net link setup' 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