Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vagrantfile multi-VM
# -*- mode: ruby -*-
# vi: set ft=ruby :
$controller_count = 3
$worker_count = 3
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
end
config.vm.provision "shell", inline: "yum -y update && yum -y install traceroute net-tools"
(0..($controller_count-1)).each do |i|
config.vm.define vm_name = "controller%d" % i do |controller|
controller.vm.hostname = vm_name
controller.vm.network :private_network, ip: "10.0.0.#{i+10}"
end
end
(0..($worker_count-1)).each do |i|
config.vm.define vm_name = "worker%d" % i do |worker|
worker.vm.hostname = vm_name
worker.vm.network :private_network, ip: "10.0.0.#{i+20}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment