89 lines
2.7 KiB
Ruby
89 lines
2.7 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__network_name: "tink_network",
|
|
libvirt__host_ip: "192.168.1.6",
|
|
libvirt__netmask: "255.255.255.248",
|
|
libvirt__dhcp_enabled: false,
|
|
libvirt__forward_mode: 'none',
|
|
libvirt__adapter: 1,
|
|
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__network_name: "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
|
|
lv.storage :file, :size => '40G'
|
|
lv.random :model => 'random'
|
|
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
|