Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IP-address range instead of single address with IP iteration counter #9

Open
Kol9yN opened this issue Dec 16, 2024 · 0 comments
Open

Comments

@Kol9yN
Copy link

Kol9yN commented Dec 16, 2024

Here is code example how it will looks in file

Vagrant.configure(2) do |config|
    N = 3 # Amount of machines should be created
    (1..N).each do |i| # Set iteration counter from 1 to N
      config.vm.define "guest#{i}" do |serv| # Define name + iteration number
        serv.vm.box = "bento/ubuntu-24.04"
        serv.vm.hostname = "guest#{i}" # Define machine name + iteration number
        serv.vm.network "private_network", ip:"192.168.112.10#{i}" # Define ip range +1 based on iteration number
        serv.vm.provider "virtualbox" do |vbox|
          vbox.memory = "1024"
          vbox.name = "guest#{i}" # Define box name + iteration number
          vbox.cpus = 2
        end
      end
    end
 
end

In result we will have:
guest1 -> 192.168.112.101
guest2 -> 192.168.112.102
guest3 -> 192.168.112.103
etc.

In UI it can looks like radio or checkbox where you can choose option what type of ip's use, single or ranged

Hope it helps ;)

@Kol9yN Kol9yN changed the title Add IP-address range instead of single address with IP counter iteration Add IP-address range instead of single address with IP iteration counter Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant