Created
July 27, 2020 05:58
-
-
Save souhaiebtar/f9b8454b23323befbe131cc4307d170b to your computer and use it in GitHub Desktop.
[vagrant cluster] a vagrant cluster configuration #vagrant #cluster
This file contains 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
servers=[ | |
{ | |
:hostname => "manager", | |
:ip => "192.168.100.10", | |
:box => "bento/ubuntu-16.04", | |
:ram => 1024, | |
:cpu => 2 | |
}, | |
{ | |
:hostname => "worker-1", | |
:ip => "192.168.100.11", | |
:box => "bento/ubuntu-16.04", | |
:ram => 1024, | |
:cpu => 2 | |
}, | |
{ | |
:hostname => "worker-2", | |
:ip => "192.168.100.12", | |
:box => "bento/ubuntu-16.04", | |
:ram => 1024, | |
:cpu => 2 | |
} | |
] | |
Vagrant.configure(2) do |config| | |
servers.each do |machine| | |
config.vm.define machine[:hostname] do |node| | |
node.vm.box = machine[:box] | |
node.vm.hostname = machine[:hostname] | |
node.vm.network "private_network", ip: machine[:ip] | |
if machine[:hostname] == "manager" | |
node.vm.provision "docker" | |
else | |
node.vm.provision "docker" | |
end | |
node.vm.provider "parallels" do |vb| | |
vb.customize ["modifyvm", :id, "--memory", machine[:ram]] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment