-
Notifications
You must be signed in to change notification settings - Fork 11
/
Vagrantfile
90 lines (74 loc) · 2.46 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# -*- mode: ruby -*-
# vi: set ft=ruby :
# From https://superuser.com/a/992220
module LocalCommand
class Config < Vagrant.plugin("2", :config)
attr_accessor :command
end
class Plugin < Vagrant.plugin("2")
name "local_shell"
config(:local_shell, :provisioner) do
Config
end
provisioner(:local_shell) do
Provisioner
end
end
class Provisioner < Vagrant.plugin("2", :provisioner)
def provision
result = system "#{config.command}"
end
end
end
Vagrant.configure("2") do |config|
config.vm.define "master" do |master|
master.vm.box = "centos/7"
master.vm.provider "hyperv" do |hv|
hv.vmname = "K8s-master"
hv.memory = 1024
hv.maxmemory = 2048
hv.cpus = 2
hv.linked_clone = true
end
master.vm.network "public_network", bridge: "Default Switch"
master.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: ".git/"
master.vm.hostname = "master.localdomain"
master.vm.provision "shell", path: "disable-swap.sh"
master.vm.provision "shell", path: "install-docker.sh"
master.vm.provision "shell", path: "install-k8s.sh"
master.vm.provision "shell", path: "setup-master.sh"
# master.vm.provision "local_shell", command: "vagrant ssh -c 'cat ~/.kube/config' master | out-file ~/.kube/config -encoding ascii"
end
config.vm.define "nodea" do |nodea|
nodea.vm.box = "centos/7"
nodea.vm.provider "hyperv" do |hv|
hv.vmname = "K8s-nodea"
hv.memory = 1024
hv.maxmemory = 2048
hv.cpus = 2
hv.linked_clone = true
end
nodea.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: ".git/"
nodea.vm.hostname = "nodea.localdomain"
nodea.vm.network "public_network", bridge: "Default Switch"
nodea.vm.provision "shell", path: "disable-swap.sh"
nodea.vm.provision "shell", path: "install-docker.sh"
nodea.vm.provision "shell", path: "install-k8s.sh"
nodea.vm.provision "shell", inline: "sh /vagrant/tmp/join.sh"
end
config.vm.define "win1" do |win1|
win1.vm.box = "WindowsServer2019Docker"
win1.vm.provider "hyperv" do |hv|
hv.vmname = "K8s-win1"
hv.memory = 4096
hv.maxmemory = 8192
hv.cpus = 2
hv.linked_clone = true
end
win1.vm.network "public_network", bridge: "Default Switch"
win1.vm.hostname = "win1"
# win1.vm.provision "shell", path: "scripts needed"
end
end