-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
45 lines (42 loc) · 1.57 KB
/
Vagrantfile
File metadata and controls
45 lines (42 loc) · 1.57 KB
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
Vagrant.configure("2") do |config| #Provisioned machine names, Ip etc..
servers=[
{
:hostname => "main",
:box => "bento/ubuntu-18.04",
:ip => "172.16.1.50",
:ssh_port => '2200'
},
{
:hostname => "server1",
:box => "bento/ubuntu-18.04",
:ip => "172.16.1.51",
:ssh_port => '2201'
},
{
:hostname => "server2",
:box => "bento/ubuntu-18.04",
:ip => "172.16.1.52",
:ssh_port => '2202'
},
{
:hostname => "server3",
:box => "bento/ubuntu-18.04",
:ip => "172.16.1.53",
:ssh_port => '2203'
}
]
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 |vb|
vb.customize ["modifyvm", :id, "--memory", 512] #specs of the provisioned machines, you can change these if you wish to adjust to your project needs.
vb.customize ["modifyvm", :id, "--cpus", 1]
end
end
end
end
#Run "Vagrant init" to initialise the provisioning of virtual machines, This will create new Vagrant directory in your folder structure .
#Run "Vagrant up" will create your 4 new machines or however many you have in your configuration.