Skip to content

Instantly share code, notes, and snippets.

@baiyongzhen
Last active August 5, 2020 13:05
Show Gist options
  • Select an option

  • Save baiyongzhen/cb6b7283b7edea434db3729db94978f0 to your computer and use it in GitHub Desktop.

Select an option

Save baiyongzhen/cb6b7283b7edea434db3729db94978f0 to your computer and use it in GitHub Desktop.
...
$num_instances = 3
(1..$num_instances).each do |i|
config.vm.define "node#{i}" do |node|
node.vm.box = "centos/7"
node.vm.hostname = "node#{i}"
ip = "192.168.8.#{i+100}"
node.vm.network "private_network", ip: ip
node.vm.provider "virtualbox" do |vb|
vb.memory = "3072"
vb.cpus = 1
vb.name = "node#{i}"
end
node.vm.provision "shell", path: "bootstrap.sh", args: [i, ip]
end
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment