Tinkerbell.Sandbox/deploy/vagrant/Vagrantfile

90 lines
2.7 KiB
Ruby
Raw 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 = "tinkerbelloss/sandbox-ubuntu1804"
provisioner.vm.box_version = "0.1.0"
2020-08-20 11:53:27 +00:00
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",
2021-01-22 14:17:19 +00:00
libvirt__network_name: "tink_network",
libvirt__host_ip: "192.168.1.6",
libvirt__netmask: "255.255.255.248",
2020-08-20 11:53:27 +00:00
libvirt__dhcp_enabled: false,
libvirt__forward_mode: 'none',
2021-01-22 14:17:19 +00:00
libvirt__adapter: 1,
2020-08-20 11:53:27 +00:00
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",
2021-01-22 14:17:19 +00:00
libvirt__network_name: "tink_network",
2020-08-20 11:53:27 +00:00
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
2021-01-22 14:17:19 +00:00
lv.storage :file, :size => '40G'
lv.random :model => 'random'
2020-08-20 11:53:27 +00:00
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