# -*- mode: ruby -*- # vi: set ft=ruby : BOX_NAME = 'projectatomic/adb' REQUIRED_PLUGINS = %w(vagrant-service-manager vagrant-sshfs) errors = [] def message(name) "#{name} plugin is not installed, run `vagrant plugin install #{name}` to install it." end # Validate and collect error message if plugin is not installed REQUIRED_PLUGINS.each { |plugin| errors << message(plugin) unless Vagrant.has_plugin?(plugin) } unless errors.empty? msg = errors.size > 1 ? "Errors: \n* #{errors.join("\n* ")}" : "Error: #{errors.first}" fail Vagrant::Errors::VagrantError.new, msg end Vagrant.configure(2) do |config| # Use environment variable BOX or default 'projectatomic/adb' config.vm.box = (ENV.key?('BOX') ? (ENV['BOX'].empty? ? BOX_NAME : ENV['BOX']) : BOX_NAME) # Setup a DHCP based private network config.vm.network "private_network", type: "dhcp" config.vm.provider "libvirt" do |libvirt, override| libvirt.driver = "kvm" libvirt.memory = 1024 libvirt.cpus = 2 libvirt.suspend_mode = "managedsave" end config.vm.provider "virtualbox" do |vbox, override| vbox.memory = 1024 vbox.cpus = 2 # Enable use of more than one virtual CPU in a virtual machine. vbox.customize ["modifyvm", :id, "--ioapic", "on"] end config.vm.provider "openstack" do |os| # Specify OpenStack authentication information os.openstack_auth_url = ENV['OS_AUTH_URL'] os.tenant_name = ENV['OS_TENANT_NAME'] os.username = ENV['OS_USERNAME'] os.password = ENV['OS_PASSWORD'] # Specify instance information os.server_name = ENV['OS_INSTANCE'] os.flavor = ENV['OS_FLAVOR'] os.image = ENV['OS_IMAGE'] os.floating_ip_pool = ENV['OS_FLOATING_IP_POOL'] os.security_groups = ['default', ENV['OS_SECURITY_GROUP']] os.keypair_name = ENV['OS_KEYPAIR_NAME'] config.ssh.private_key_path = ENV['OS_PRIVATE_KEYPATH'] config.ssh.username = 'vagrant' end config.vm.synced_folder '.', '/vagrant', disabled: true if Vagrant::Util::Platform.windows? target_path = ENV['USERPROFILE'].gsub(/\\/,'/').gsub(/[[:alpha:]]{1}:/){|s|'/' + s.downcase.sub(':', '')} config.vm.synced_folder ENV['USERPROFILE'], target_path, type: 'sshfs', sshfs_opts_append: '-o umask=000 -o uid=1000 -o gid=1000' else config.vm.synced_folder ENV['HOME'], ENV['HOME'], type: 'sshfs', sshfs_opts_append: '-o umask=000 -o uid=1000 -o gid=1000' end config.vm.provision "shell", inline: <<-SHELL sudo setsebool -P virt_sandbox_use_fusefs 1 SHELL end