Add support for a nat-less libvirt deployment and multiple workers
This commit is contained in:
parent
dbf51c823e
commit
21bc78b77d
32
deploy/vagrant/Vagrantfile
vendored
32
deploy/vagrant/Vagrantfile
vendored
@ -1,5 +1,7 @@
|
||||
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
|
||||
|
||||
num_workers = ENV['TINKERBELL_NUM_WORKERS'] || '1'
|
||||
|
||||
# Returns true if `GUI` environment variable exists, value does not matter.
|
||||
# Defaults to false
|
||||
def worker_gui_enabled?
|
||||
@ -12,6 +14,14 @@ def worker_display_scale_enabled?
|
||||
ENV.include?('VAGRANT_WORKER_SCALE')
|
||||
end
|
||||
|
||||
def configure_nat
|
||||
return ENV.has_key?('TINKERBELL_CONFIGURE_NAT') ? ENV['TINKERBELL_CONFIGURE_NAT'] : 'true'
|
||||
end
|
||||
|
||||
def libvirt_forward_mode
|
||||
return configure_nat == 'false' ? 'nat' : 'none'
|
||||
end
|
||||
|
||||
Vagrant.configure('2') do |config|
|
||||
|
||||
config.vm.define :provisioner do |provisioner|
|
||||
@ -19,7 +29,11 @@ Vagrant.configure('2') do |config|
|
||||
provisioner.vm.box_version = "0.1.0"
|
||||
provisioner.vm.hostname = 'provisioner'
|
||||
provisioner.vm.synced_folder './../../', '/vagrant'
|
||||
provisioner.vm.provision :shell, path: './scripts/tinkerbell.sh'
|
||||
provisioner.vm.provision :shell,
|
||||
path: './scripts/tinkerbell.sh',
|
||||
env: {
|
||||
'TINKERBELL_CONFIGURE_NAT': configure_nat,
|
||||
}
|
||||
|
||||
provisioner.vm.network :private_network,
|
||||
virtualbox__intnet: "tink_network",
|
||||
@ -27,7 +41,7 @@ Vagrant.configure('2') do |config|
|
||||
libvirt__host_ip: "192.168.1.6",
|
||||
libvirt__netmask: "255.255.255.248",
|
||||
libvirt__dhcp_enabled: false,
|
||||
libvirt__forward_mode: 'none',
|
||||
libvirt__forward_mode: libvirt_forward_mode,
|
||||
libvirt__adapter: 1,
|
||||
auto_config: false
|
||||
|
||||
@ -47,14 +61,19 @@ Vagrant.configure('2') do |config|
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "worker" do |worker|
|
||||
|
||||
(1..num_workers.to_i).each do |i|
|
||||
mac_suffix = "%02x" % i
|
||||
worker_suffix = i==1 ? "" : "i"
|
||||
config.vm.define "worker#{worker_suffix}" do |worker|
|
||||
|
||||
worker.vm.box = nil
|
||||
worker.vm.network :private_network,
|
||||
mac: "080027000001",
|
||||
mac: "0800270000#{mac_suffix}",
|
||||
virtualbox__intnet: "tink_network",
|
||||
libvirt__network_name: "tink_network",
|
||||
libvirt__dhcp_enabled: false,
|
||||
libvirt__forward_mode: 'none',
|
||||
libvirt__forward_mode: libvirt_forward_mode,
|
||||
auto_config: false
|
||||
|
||||
worker.vm.provider :libvirt do |lv|
|
||||
@ -82,8 +101,9 @@ Vagrant.configure('2') do |config|
|
||||
'--boot2', 'none',
|
||||
'--boot3', 'none',
|
||||
'--boot4', 'none',
|
||||
'--macaddress1', '080027000001'
|
||||
'--macaddress1', "0800270000#{mac_suffix}"
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -45,10 +45,12 @@ main() (
|
||||
|
||||
./setup.sh
|
||||
|
||||
if [[ ${TINKERBELL_CONFIGURE_NAT:=true} != "false" ]]; then
|
||||
setup_nat
|
||||
fi
|
||||
|
||||
secure_certs
|
||||
configure_vagrant_user
|
||||
|
||||
)
|
||||
|
||||
main
|
||||
|
Loading…
Reference in New Issue
Block a user