-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
72 lines (62 loc) · 1.84 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- mode: ruby -*-
# vi: set ft=ruby :
boxes = [
{
:name => "dns",
:eth1 => "192.168.120.8",
:eth2 => "192.168.120.2",
:mem => "2048",
:cpu => "2"
},
{
:name => "dns-backup",
:eth1 => "192.168.120.9",
:eth3 => "192.168.120.3",
:mem => "2048",
:cpu => "2"
},
{
:name => "internal-test",
:eth1 => "192.168.120.100",
:mem => "2048",
:cpu => "2"
},
{
:name => "webserver",
:eth1 => "192.168.120.101",
:mem => "2048",
:cpu => "2"
},
{
:name => "external-test",
:eth1 => "192.168.121.10",
:eth3 => "192.168.120.134",
:mem => "2048",
:cpu => "2"
}
]
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-20.04"
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.hostname = opts[:name]
# configure virtualbox
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--name", opts[:name]]
v.customize ["modifyvm", :id, "--memory", opts[:mem]]
v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
end
# run install script and copy startup script upon provision
config.vm.provision :shell, inline: "/vagrant/scripts/install/" + opts[:name] + "_install.sh"
config.vm.provision :shell, inline: "cp /vagrant/scripts/startup/" + opts[:name] + "_startup.sh ~/"
# set ethernet port
config.vm.network :private_network, ip: opts[:eth1], virtualbox__intnet: true
if opts.key?(:eth2)
config.vm.network :private_network, ip: opts[:eth2], virtualbox__intnet: true
end
if opts.key?(:eth3)
config.vm.network :private_network, ip: opts[:eth3], auto_config:false, virtualbox__intnet: true
end
end
end
end