72 lines
2.0 KiB
Ruby
72 lines
2.0 KiB
Ruby
|
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
|
||
|
|
||
|
# Returns true if `GUI` environment variable is set to a non-empty value.
|
||
|
# Defaults to false
|
||
|
def worker_gui_enabled?
|
||
|
ENV.fetch('VAGRANT_WORKER_GUI', '').empty?
|
||
|
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 [
|
||
|
'modifyvm', :id,
|
||
|
'--nic1', 'none',
|
||
|
'--boot1', 'net',
|
||
|
'--boot2', 'none',
|
||
|
'--boot3', 'none',
|
||
|
'--boot4', 'none',
|
||
|
'--macaddress1', '080027000001'
|
||
|
]
|
||
|
end
|
||
|
end
|
||
|
end
|