Created
November 29, 2023 13:08
-
-
Save eznix86/1cafdf2bf091612a64f6e042ab514f24 to your computer and use it in GitHub Desktop.
Vagrant VMs with different subnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
vms_in_network1 = 2 | |
vms_in_network2 = 3 | |
(1..vms_in_network1).each do |i| | |
config.vm.define "vm#{i}" do |vm| | |
vm.vm.box = "ubuntu/noble64" | |
vm.vm.network "private_network", ip: "192.168.33.#{i + 9}" # 192.168.33.xxx | |
end | |
end | |
(1..vms_in_network2).each do |i| | |
config.vm.define "vm#{i + vms_in_network1}" do |vm| | |
vm.vm.box = "ubuntu/noble64" | |
vm.vm.network "private_network", ip: "192.168.34.#{i + 9}" # 192.168.34.xxx | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment