Last active
September 26, 2018 19:56
-
-
Save kenanhancer/997bc196430193a75d9f3d432089b5e2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vagrantfile which creates one master node and 2 worker nodes.