- # The machine pool used by cluster creation
- (1..vars[:num_machines]).each do |i|
- config.vm.define "machine-#{i}" do |m|
- m.vm.hostname = "machine-#{i}"
- m.vm.provider :libvirt do |libvirt|
- libvirt.graphics_ip = '0.0.0.0'
- libvirt.default_prefix = "#{vars[:site]}-"
- libvirt.cpu_mode = 'host-passthrough'
- libvirt.cpus = 8
- libvirt.memory = 16384
- libvirt.nested = true
- # The image will be provisioned by ICN so just create an empty
- # disk for the machine
- libvirt.storage :file, :size => 50, :type => 'raw', :cache => 'none'
- # Management attach is false so that vagrant will not interfere
- # with these machines: the jump server will manage them
- # completely
- libvirt.mgmt_attach = false
- end
- # The provisioning network must be listed first for PXE boot to
- # the metal3/ironic provided image
- m.vm.network :private_network,
- :libvirt__network_name => "#{vars[:site]}-provisioning",
- :type => 'dhcp'
- m.vm.network :private_network,
- :libvirt__network_name => "#{vars[:site]}-baremetal",
- :type => 'dhcp'
-
- # IPMI control
- m.trigger.after [:up] do |trigger|
- trigger.name = 'Adding machine to IPMI network'
- trigger.run = {inline: "./tools/vagrant/add_machine_to_vbmc.sh #{i} #{vars[:site]} machine-#{i}"}
- end
- m.trigger.after [:destroy] do |trigger|
- trigger.name = 'Removing machine from IPMI network'
- trigger.run = {inline: "./tools/vagrant/remove_machine_from_vbmc.sh #{i} #{vars[:site]} machine-#{i}"}
- end
+ # Look for any HelmReleases in the site directory with machineName in
+ # the values dictionary. This will provide the values needed to
+ # create the machine pool.
+ legacy_machine_args = ""
+ Dir.glob("deploy/site/#{site}/*.yaml") do |file|
+ YAML.load_stream(File.read(file)) do |document|
+ values = document.fetch('spec', {}).fetch('values', {})
+ next if values['machineName'].nil? || values['bootMACAddress'].nil?
+ machine_name = values['machineName']
+ boot_mac_address = values['bootMACAddress']
+ bmc_port = URI.parse(values['bmcAddress']).port
+ config.vm.define machine_name do |m|
+ m.vm.hostname = machine_name
+ m.vm.provider :libvirt do |libvirt|
+ libvirt.graphics_ip = '0.0.0.0'
+ libvirt.default_prefix = "#{site}-"
+ libvirt.cpu_mode = 'host-passthrough'
+ libvirt.cpus = 8
+ libvirt.memory = 16384
+ libvirt.nested = true
+ # The image will be provisioned by ICN so just create an empty
+ # disk for the machine
+ libvirt.storage :file, :size => 50, :type => 'raw', :cache => 'none'
+ # Management attach is false so that vagrant will not interfere
+ # with these machines: the jump server will manage them
+ # completely
+ libvirt.mgmt_attach = false
+ end
+ # The provisioning network must be listed first for PXE boot to
+ # the metal3/ironic provided image
+ m.vm.network :private_network,
+ :libvirt__network_name => "#{site}-provisioning",
+ :mac => boot_mac_address,
+ :type => 'dhcp'
+ m.vm.network :private_network,
+ :libvirt__network_name => "#{site}-baremetal",
+ :type => 'dhcp'