-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
49 lines (43 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
49
IMAGE_NAME = "generic/ubuntu1804"
N = 4
# Please make sure you have created the necessary synced folders on your local storage
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.provider "libvirt" do |vm|
vm.cpus = 2
vm.driver = "kvm"
vm.memory = 4096
vm.nic_model_type = "e1000"
vm.qemu_use_session = false
vm.management_network_address = '192.170.0.0/24'
end
config.vm.define "master" do |master|
master.vm.box = IMAGE_NAME
master.vm.network "private_network", ip: "192.169.50.10"
master.vm.hostname = "master"
master.vm.provision "ansible" do |ansible|
ansible.playbook = "master-playbook.yml"
ansible.extra_vars = {
node_ip: "192.169.50.10",
}
end
end
(1..N).each do |i|
config.vm.define "node-#{i}" do |node|
node.vm.box = IMAGE_NAME
node.vm.network "private_network", ip: "192.169.50.#{i + 10}"
node.vm.hostname = "node-#{i}"
node.vm.synced_folder "/home/vagrant-volumes/node-#{i}", "/mnt/k8s-volume", type: "9p"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "node-playbook.yml"
ansible.extra_vars = {
node_ip: "192.169.50.#{i + 10}",
}
end
end
end
end