-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
54 lines (41 loc) · 1.33 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
servers=[
{
:hostname => "k8smaster",
:ip => "192.168.100.2",
:type => "master",
:ram => 2024,
:cpu => 3
},
{
:hostname => "k8sslave",
:ip => "192.168.100.3",
:type => "slave",
:ram => 2024,
:cpu => 2
}
]
Vagrant.configure("2") do |config|
# hosts=''
# servers.each do |machine|
# hosts+= "echo '" + machine[:ip]+" "+machine[:hostname]+"' >> /etc/hosts \n"
# end
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
node.vm.box = "bento/ubuntu-20.04"
node.vm.hostname = machine[:hostname]
node.vm.network "public_network", ip: machine[:ip]
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", machine[:ram]]
vb.customize ["modifyvm", :id, "--cpus", machine[:cpu]]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--name", machine[:hostname]]
end
# node.vm.provision :shell, :path => "common.sh"
# node.vm.provision :shell, :inline => hosts
# if machine[:type] == 'master'
# node.vm.provision :shell, :path => "controleplane.sh"
# end
end
end
end