-
Notifications
You must be signed in to change notification settings - Fork 121
/
Vagrantfile
52 lines (46 loc) · 1.21 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
Vagrant.configure("2") do |config|
servers=[
{
:hostname => "ansible-control",
:box => "bento/ubuntu-18.04",
:ip => "192.168.56.100",
:ssh_port => '2215'
},
{
:hostname => "db01",
:box => "bento/ubuntu-18.04",
:ip => "192.168.56.101",
:ssh_port => '2210'
},
{
:hostname => "web01",
:box => "bento/ubuntu-18.04",
:ip => "192.168.56.102",
:ssh_port => '2211'
},
{
:hostname => "web02",
:box => "bento/ubuntu-18.04",
:ip => "192.168.56.103",
:ssh_port => '2212'
},
{
:hostname => "loadbalancer",
:box => "bento/ubuntu-18.04",
:ip => "192.168.56.104",
:ssh_port => '2213'
}
]
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]
node.vm.network "forwarded_port", guest: 22, host: machine[:ssh_port], id: "ssh"
node.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 512]
v.customize ["modifyvm", :id, "--name", machine[:hostname]]
end
end
end
end