-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathVagrantfile
41 lines (41 loc) · 975 Bytes
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
servers=[
{
:hostname => "manager",
:ip => "192.168.100.10",
:box => "ubuntu/trusty64",
:ram => 1024,
:cpu => 2
},
{
:hostname => "worker-1",
:ip => "192.168.100.11",
:box => "ubuntu/trusty64",
:ram => 1024,
:cpu => 2
},
{
:hostname => "worker-2",
:ip => "192.168.100.12",
:box => "ubuntu/trusty64",
: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",
images: ["monicagangwar/docker-swarm-vagrant"]
else
node.vm.provision "docker"
end
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", machine[:ram]]
end
end
end
end