0

i'm using multi-machine setup and launching 5 machines, when i type vagrant up i want the input to be a default value of 1 when i'm asked about it (i don't want to keep typing 1 five times)

Preview of Input options upon typing vagrant up command

here's the vagrant file

IMAGE_NAME = "ubuntu/bionic64"
N = 2

Vagrant.configure("2") do |config|
  config.vm.box_check_update = false

  # Master Nodes
  (1..N).each do |i|
    config.vm.define "master-#{i}" do |master|
      master.vm.box = IMAGE_NAME
      master.vm.hostname = "master-#{i}"
      master.vm.network "public_network", ip: "192.168.5.#{i + 10}"
      master.vm.network "private_network", ip: "192.168.11.#{i + 10}"
    end
  end

  # Worker Nodes 
  (1..N).each do |i|
    config.vm.define "node-#{i}" do |node|
      node.vm.box = IMAGE_NAME
      node.vm.hostname = "node-#{i}"
      node.vm.network "public_network", ip: "192.168.6.#{i + 10}"
      node.vm.network "private_network", ip: "192.168.12.#{i + 10}"
    end
  end

  # Load Balancer 
  config.vm.define "load-balancer" do |lb|
    lb.vm.box = IMAGE_NAME
    lb.vm.hostname = "load-balancer"
    lb.vm.network "public_network", ip: "192.168.7.11"
    lb.vm.network "private_network", ip: "192.168.13.11"
  end
end

theJaxon
  • 83
  • 1
  • 4
  • Where are you querying for input? – Matthew Schuchard May 19 '20 at 10:58
  • @MattSchuchard I'm not querying for any input, this is the default behavior of vagrant on windows (check the attached image) whenever i add anything related to network configuration, it asks for the input after the vagrant up command. – theJaxon May 19 '20 at 22:28

1 Answers1

0

in your Vagrantfile, you should add wherever you're using the public_network you need to specify the network adapter

<machine>.vm.network "public_network", ip: xxx, bridge: "nat"
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • Can't thank you enough, after searching for the bridge option i found that it was stated in the official documentation https://www.vagrantup.com/docs/networking/public_network.html and even asked on stackoverflow but clarified even better https://stackoverflow.com/questions/33250304/how-to-automatically-select-bridged-network-interfaces-in-vagrant so this should be marked as duplicate at this point i guess. Again thank you so much for your help. – theJaxon May 20 '20 at 21:46
  • right I did not remember I wrote this one :) glad to help anyway – Frederic Henri May 21 '20 at 09:24