-
Notifications
You must be signed in to change notification settings - Fork 8
/
Vagrantfile
48 lines (47 loc) · 1.48 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
vm_list = [
{
:name => "k8s-master",
:eth1 => "192.168.100.21",
:mem => "4096",
:cpu => "2",
:sshport => 22230
},
{
:name => "k8s-worker1",
:eth1 => "192.168.100.22",
:mem => "2048",
:cpu => "2",
:sshport => 22231
},
{
:name => "k8s-worker2",
:eth1 => "192.168.100.23",
:mem => "2048",
:cpu => "2",
:sshport => 22232
}
]
Vagrant.configure(2) do |config|
config.vm.box = "gusztavvargadr/ubuntu-server"
config.vm.box_check_update = false
Encoding.default_external = 'UTF-8'
vm_list.each do |item|
config.vm.define item[:name] do |vm_config|
vm_config.vm.hostname = item[:name]
vm_config.vm.network "public_network", ip: item[:eth1]
vm_config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true"
vm_config.vm.network "forwarded_port", guest: 22, host: item[:sshport]
vm_config.vm.provider "virtualbox" do |vb|
vb.memory = item[:mem];
vb.cpus = item[:cpu];
vb.name = item[:name];
end
vm_config.vm.provision "shell", path: "scripts/common.sh"
if item[:name] == "k8s-master"
vm_config.vm.provision "shell", path: "scripts/master.sh"
else
vm_config.vm.provision "shell", path: "scripts/worker.sh"
end
end
end
end