bifrost/tools/vagrant_dev_env/Vagrantfile

57 lines
2.3 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
ansible_install_root=(ENV['ANSIBLE_INSTALL_ROOT'] || "/opt/stack")
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'ubuntu/trusty64'
config.vm.define 'bifrost' do |bifrost|
bifrost.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', '4096', '--cpus', '1', '--cpuexecutioncap', '80']
# the setting below are to improve performance on mac's and should have little impact elsewhere.
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
vb.customize ["modifyvm", :id, "--nictype2", "Am79C973"]
vb.customize ["modifyvm", :id, "--nictype3", "Am79C973"]
end
# If ANSIBLE_INSTALL_ROOT is available, set that value inside the VM
if ENV['ANSIBLE_INSTALL_ROOT']
bifrost.vm.provision "shell", inline: <<-SHELL
echo "export ANSIBLE_INSTALL_ROOT=#{ENV['ANSIBLE_INSTALL_ROOT']}" >> /etc/profile.d/ansible-root.sh
SHELL
end
# Set up private NAT'd network
bifrost.vm.network 'private_network', ip: '192.168.99.10' # it goes to 11
# This assumes you have DHCP on your bridged network. if not you will need
# to statically configure to allow Bifrost to manage hardware attached to
# the bridged interface.
# NOTE(TheJulia): Is there a way to abstract the bridged networking...
# NOTE(NobodyCam): until the above is done this needs to be set to a valid interface
bifrost.vm.network 'public_network', bridge: ''
# besure we get the entire bifrost directory tree
bifrost.vm.synced_folder "../../.", "/home/vagrant/bifrost", type: "rsync"
bifrost.vm.provision 'ansible' do |ansible|
ansible.verbose = 'v'
ansible.playbook = 'vagrant.yml'
ansible.extra_vars = {
# set key file name here
ansible_install_root: ansible_install_root,
public_key: 'id_rsa.pub',
# Edit the network_interface to match your needs:
# eth0 - connected to a Nat network
# eth1 - connected to Host-only network named: 'vboxnet1'
# eth2 - bridged - Interface must also be set above
network_interface: 'eth2'
}
end
end
end