-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
71 lines (59 loc) · 1.98 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# N corresponds to the number of secondary MongoDB nodes
MASTERS = 1
NODES = 2
ansible_groups = {
"masters" => [
"kubernetes-master-[1:#{MASTERS}]"
],
"nodes" => [
"kubernetes-node-[1:#{NODES}]"
]
}
Vagrant.configure("2") do |config|
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = true
(1..MASTERS).each do |master_no|
config.vm.define "kubernetes-master-#{master_no}" do |master|
master.vm.hostname = "master-#{master_no}"
master.vm.network "private_network", ip: "192.168.60.#{10+master_no}"
master.vm.provider "virtualbox" do |vb|
vb.cpus = "2"
vb.memory = "4096"
end
master.vm.provision "hostmanager"
master.vm.provision "shell",
inline: "test -e /usr/bin/python || (apt-get -qqy update && apt-get install -qqy python-minimal)"
master.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/kubernetes.yml"
ansible.groups = ansible_groups
ansible.config_file = "ansible/ansible.cfg"
# ansible.verbose = "True"
end
end
end
(1..NODES).each do |node_no|
config.vm.define "kubernetes-node-#{node_no}" do |node|
node.vm.hostname = "node-#{node_no}"
node.vm.network "private_network", ip: "192.168.65.#{10+node_no}"
node.vm.provider "virtualbox" do |vb|
vb.cpus = "2"
vb.memory = "4096"
end
node.vm.provision "hostmanager"
node.vm.provision "shell",
inline: "test -e /usr/bin/python || (apt-get -qqy update && apt-get install -qqy python-minimal)"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/kubernetes.yml"
ansible.groups = ansible_groups
ansible.config_file = "ansible/ansible.cfg"
ansible.verbose = "True"
end
end
end
end