forked from rootsongjc/kubernetes-vagrant-centos-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
31 lines (29 loc) · 1.15 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# on win10, you need `vagrant plugin install vagrant-vbguest --plugin-version 0.21` and change synced_folder.type="virtualbox"
# reference `https://www.dissmeyer.com/2020/02/11/issue-with-centos-7-vagrant-boxes-on-windows-10/`
Vagrant.configure("2") do |config|
config.vm.box_check_update = false
config.vm.provider 'virtualbox' do |vb|
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ]
end
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
$num_instances = 3
# curl https://discovery.etcd.io/new?size=3
$etcd_cluster = "node1=http://172.17.8.101:2380"
(1..$num_instances).each do |i|
config.vm.define "node#{i}" do |node|
node.vm.box = "centos/7"
node.vm.box_version = "1804.02"
node.vm.hostname = "node#{i}"
ip = "172.17.8.#{i+100}"
node.vm.network "private_network", ip: ip
node.vm.provider "virtualbox" do |vb|
vb.memory = "3072"
vb.cpus = 1
vb.name = "node#{i}"
end
node.vm.provision "shell", path: "install.sh", args: [i, ip, $etcd_cluster]
end
end
end