Skip to content

Instantly share code, notes, and snippets.

@kenanhancer
Last active September 26, 2018 19:56
Show Gist options
  • Save kenanhancer/997bc196430193a75d9f3d432089b5e2 to your computer and use it in GitHub Desktop.
Save kenanhancer/997bc196430193a75d9f3d432089b5e2 to your computer and use it in GitHub Desktop.
MASTER_NODE_IP="192.168.33.10"
WORKER_NODE_IP_START="192.168.33.10"
Vagrant.configure("2") do |config|
config.vm.define "masternode" do |node|
node.vm.box = "ubuntu/xenial64"
node.vm.hostname = "masternode"
node.vm.network "forwarded_port", guest: 8001, host: 8001
node.vm.network "private_network", ip: "#{MASTER_NODE_IP}"
node.vm.provision "shell", inline: "echo 'cd /vagrant' >> ~/.bashrc && exit", privileged: false
node.vm.provision "shell", inline: "route add 10.96.0.1 gw #{MASTER_NODE_IP} && exit", privileged: true, run: "always"
node.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 1
end
end
(1..2).each do |i|
config.vm.define "workernode#{i}" do |node|
node.vm.box = "ubuntu/xenial64"
node.vm.hostname = "workernode#{i}"
node.vm.network "private_network", ip: "#{WORKER_NODE_IP_START}#{i}"
node.vm.provision "shell", inline: "echo 'cd /vagrant' >> ~/.bashrc && exit", privileged: false
node.vm.provision "shell", inline: "route add 10.96.0.1 gw #{MASTER_NODE_IP} && exit", privileged: true, run: "always"
node.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 1
end
end
end
end
@kenanhancer
Copy link
Author

Vagrantfile which creates one master node and 2 worker nodes.

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