Skip to content

Instantly share code, notes, and snippets.

@marcuslang
Last active September 25, 2022 17:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marcuslang/9e31543ec583ddeef29734ab47ea0474 to your computer and use it in GitHub Desktop.
Save marcuslang/9e31543ec583ddeef29734ab47ea0474 to your computer and use it in GitHub Desktop.
Create multiple Vagrant VMs with different ips in a for loop
Vagrant.configure("2") do |config|
(1..3).each do |i|
config.vm.define "node-#{i}" do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.network "private_network", ip: "192.168.25.#{i}", auto_config: false
node.vm.provision "shell", inline: "echo hello from node #{i}"
end
end
end
@zuwarskej
Copy link

thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment