-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
63 lines (40 loc) · 1.27 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
def configure_vm(vm, **opts)
vm.box = opts.fetch(:box, "centos/7")
vm.network :private_network, ip: opts[:private_ip]
vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
end
vm.provider :libvirt do |domain|
domain.memory = opts.fetch(:memory, 4096)
domain.cpus = opts.fetch(:cpus, 2)
domain.nested = true
end
# Disable default share, because we dont use it
vm.synced_folder ".", "/vagrant", disabled: true
end
def apply_ansible(vm, playbook)
vm.provision :ansible do |ansible|
ansible.host_key_checking = false
ansible.playbook = playbook
ansible.verbose = "v"
end
end
Vagrant.configure(2) do |config|
# ---------------------------------------------------------------------------------------------
#
# Definition of the VM for running kubernetes master.
#
config.vm.define "master" do |master|
configure_vm(master.vm, private_ip: "192.168.123.110")
apply_ansible(master.vm, "ansible-master.yaml")
end
# ---------------------------------------------------------------------------------------------
#
# Definition of the VM for running kubernetes node.
#
config.vm.define "node" do |node|
configure_vm(node.vm, private_ip: "192.168.123.120")
apply_ansible(node.vm, "ansible-node.yaml")
end
end