Skip to content

Instantly share code, notes, and snippets.

@souhaiebtar
Created July 27, 2020 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save souhaiebtar/f9b8454b23323befbe131cc4307d170b to your computer and use it in GitHub Desktop.
Save souhaiebtar/f9b8454b23323befbe131cc4307d170b to your computer and use it in GitHub Desktop.
[vagrant cluster] a vagrant cluster configuration #vagrant #cluster
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