-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
57 lines (50 loc) · 1.81 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
# number of worker nodes
NUM_WORKERS = 2
# number of extra disks per worker
NUM_DISKS = 1
# size of each disk in gigabytes
DISK_GBS = 10
MASTER_IP = "192.168.73.100"
WORKER_IP_BASE = "192.168.73.2" # 200, 201, ...
TOKEN = "yi6muo.4ytkfl3l6vl8zfpk"
Vagrant.configure("2") do |config|
config.vm.box = "oraclelinux/8"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :libvirt do |libvirt|
libvirt.cpu_mode = 'host-passthrough'
libvirt.graphics_type = 'none'
libvirt.memory = 2048
libvirt.cpus = 2
libvirt.qemu_use_session = false
end
config.vm.provision "shell", path: "common.sh"
config.vm.provision "shell", path: "local-storage/create-volumes.sh"
config.vm.define "master" do |master|
master.vm.hostname = "master"
master.vm.network :private_network, ip: MASTER_IP
master.vm.provision "shell", path: "master.sh",
env: { "MASTER_IP" => MASTER_IP, "TOKEN" => TOKEN }
master.vm.provision :file do |file|
file.source = "local-storage/storageclass.yaml"
file.destination = "/tmp/local-storage-storageclass.yaml"
end
master.vm.provision :file do |file|
file.source = "local-storage/provisioner.yaml"
file.destination = "/tmp/local-storage-provisioner.yaml"
end
master.vm.provision "shell", path: "local-storage/install.sh"
end
(0..NUM_WORKERS-1).each do |i|
config.vm.define "worker#{i}" do |worker|
worker.vm.hostname = "worker#{i}"
worker.vm.network :private_network, ip: "#{WORKER_IP_BASE}" + i.to_s.rjust(2, '0')
(1..NUM_DISKS).each do |j|
worker.vm.provider :libvirt do |libvirt|
libvirt.storage :file, :size => "#{DISK_GBS}G"
end
end
worker.vm.provision "shell", path: "worker.sh",
env: { "MASTER_IP" => MASTER_IP, "TOKEN" => TOKEN }
end
end
end