-
Notifications
You must be signed in to change notification settings - Fork 379
/
Vagrantfile
43 lines (35 loc) · 1 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
Vagrant.require_version ">= 1.7.0"
$os_image = (ENV['OS_IMAGE'] || "ubuntu16").to_sym
def set_vbox(vb, config)
vb.gui = false
vb.memory = 2048
vb.cpus = 1
case $os_image
when :centos7
config.vm.box = "bento/centos-7.2"
when :ubuntu16
config.vm.box = "bento/ubuntu-16.04"
end
end
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox"
master = 1
node = 2
private_count = 10
(1..(master + node)).each do |mid|
name = (mid <= node) ? "n" : "m"
id = (mid <= node) ? mid : (mid - node)
config.vm.define "k8s-#{name}#{id}" do |n|
n.vm.hostname = "k8s-#{name}#{id}"
ip_addr = "192.16.35.#{private_count}"
n.vm.network :private_network, ip: "#{ip_addr}", auto_config: true
n.vm.provider :virtualbox do |vb, override|
vb.name = "#{n.vm.hostname}"
set_vbox(vb, override)
end
private_count += 1
end
end
# Install of dependency packages using script
config.vm.provision :shell, path: "./hack/setup-vms.sh"
end