Tinkerbell.Sandbox/deploy/vagrant/Vagrantfile

82 lines
2.3 KiB
Ruby
Raw Permalink Normal View History

2020-08-20 11:53:27 +00:00
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
# Returns true if `GUI` environment variable exists, value does not matter.
2020-08-20 11:53:27 +00:00
# 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')
2020-08-20 11:53:27 +00:00
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?
2020-08-20 11:53:27 +00:00
vb.customize [
'modifyvm', :id,
'--nic1', 'none',
'--boot1', 'net',
'--boot2', 'none',
'--boot3', 'none',
'--boot4', 'none',
'--macaddress1', '080027000001'
]
end
end
end