Tinkerbell.Sandbox/deploy/vagrant/Vagrantfile
James W. Brinkerhoff adfccfb1b0 Vagrant virtualbox worker env override fixes
* Change ENV var check to only validate the existence of the
  var in the local env
* Add VAGRANT_WORKER_SCALE env variable override to control
  GUI scaling for virtualbox

Signed-off-by: James W. Brinkerhoff <jwb@paravolve.net>
2020-09-23 07:40:38 -04:00

82 lines
2.3 KiB
Ruby

ENV['VAGRANT_NO_PARALLEL'] = 'yes'
# Returns true if `GUI` environment variable exists, value does not matter.
# Defaults to false
def worker_gui_enabled?
ENV.include?('VAGRANT_WORKER_GUI')
end
# Returns true if `SCALE` environment variable exists, value does not matter.
# Defaults to false
def worker_display_scale_enabled?
ENV.include?('VAGRANT_WORKER_SCALE')
end
Vagrant.configure('2') do |config|
config.vm.define :provisioner do |provisioner|
provisioner.vm.box = 'generic/ubuntu1804'
provisioner.vm.hostname = 'provisioner'
provisioner.vm.synced_folder './../../', '/vagrant'
provisioner.vm.provision :shell, path: './scripts/tinkerbell.sh'
provisioner.vm.network :private_network,
virtualbox__intnet: "tink_network",
libvirt__dhcp_enabled: false,
libvirt__forward_mode: 'none',
auto_config: false
provisioner.vm.network "forwarded_port", guest: 42113, host: 42113
provisioner.vm.network "forwarded_port", guest: 42114, host: 42114
provisioner.vm.provider :libvirt do |lv, override|
lv.memory = 2*1024
lv.cpus = 2
lv.cpu_mode = 'host-passthrough'
end
provisioner.vm.provider :virtualbox do |vb, override|
vb.memory = 2*1024
vb.cpus = 2
end
end
config.vm.define "worker" do |worker|
worker.vm.box = nil
worker.vm.network :private_network,
mac: "080027000001",
virtualbox__intnet: "tink_network",
libvirt__dhcp_enabled: false,
libvirt__forward_mode: 'none',
auto_config: false
worker.vm.provider :libvirt do |lv|
lv.memory = 4*1024
lv.cpus = 1
lv.boot 'network'
lv.mgmt_attach = false
end
worker.vm.provider :virtualbox do |vb, worker|
worker.vm.box = 'generic/alpine38'
vb.memory = 4*1024
vb.cpus = 1
vb.gui = worker_gui_enabled?
vb.customize [
'setextradata', :id,
'GUI/ScaleFactor', '3.0'
] if worker_display_scale_enabled?
vb.customize [
'modifyvm', :id,
'--nic1', 'none',
'--boot1', 'net',
'--boot2', 'none',
'--boot3', 'none',
'--boot4', 'none',
'--macaddress1', '080027000001'
]
end
end
end