Update basic-builder definition for private cloud
[releng/builder.git] / vagrant / basic-builder / Vagrantfile
index 54040185afe825e8c870e2dfaf5eff853e12491b..0622a7a78f48906077194de13b5b80efcc18d779 100644 (file)
@@ -25,17 +25,40 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   # config.ssh.private_key_path -- set this outside the openstack block
   #         in your base box
   config.vm.provider :openstack do |os, override|
-    # Default the CentOS 6.5 - Vagrant ready image unless overriden by a RSIMAGE
-    # environment variable
+    if ENV['BOX']
+      override.vm.box = ENV['BOX']
+    else
+      override.vm.box = 'dummy'
+    end
+    config.ssh.username = 'centos'
+    os.flavor = 'm1.small'
+
+    # 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
-      os.image = 'CentOS 7 - baseline - 20151215'
+      os.image = 'BAD IMAGE'
+      override.ssh.username = 'baduser'
     end
 
     case ENV['IMAGE']
+      when /.*ubuntu.*/i
+        override.ssh.username = 'ubuntu'
+
+      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;"
+
       when /.*centos.*/i
         override.ssh.username = 'centos'
+
+        # 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
 
@@ -43,7 +66,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   config.vm.synced_folder ".", "/vagrant"
   config.vm.synced_folder "../lib/", "/vagrant/lib"
 
-  # run our bootstrapping for the ovsdb-devstack system
+  # 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'
 
   #################