# -*- 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 openstack provider dummy box config.vm.box = "dummy" config.ssh.username = 'root' # make sure to set the following in your # ~/.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 # os.key_name # config.ssh.private_key_path -- set this outside the openstack block # in your base box config.vm.provider :openstack do |os, override| 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 = '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 # 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 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