-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
64 lines (55 loc) · 1.68 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
# Defines our Vagrant environment
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
system("
case #{ARGV[0]} in
'up')
echo `pwd`
ssh-keygen -t rsa -N \"\" -f ./files/id_rsa
;;
'destroy')
echo destroy
rm -f ./files/id_rsa*
;;
'status')
;;
*)
;;
esac
")
#Create new keys
Vagrant.configure("2") do |config|
# create mgmt node
config.vm.define "k8s-mgmt" do |mgmt_config|
mgmt_config.vm.box = "centos/7"
mgmt_config.vm.hostname = "k8s-mgmt"
mgmt_config.vm.network :private_network, ip: "10.0.15.10"
mgmt_config.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
mgmt_config.vm.provision :shell, path: "bootstrap-mgmt.sh"
config.vm.provision "shell", inline: <<-EOC
sudo sed -i -e "\\#PasswordAuthentication no# s#PasswordAuthentication no#PasswordAuthentication yes#g" /etc/ssh/sshd_config
sudo systemctl restart sshd
EOC
end
# create some web servers
# https://docs.vagrantup.com/v2/vagrantfile/tips.html
(1..2).each do |i|
config.vm.define "k8s-node#{i}" do |node|
node.vm.box = "centos/7"
node.vm.hostname = "k8s-node#{i}"
node.vm.network :private_network, ip: "10.0.15.2#{i}"
node.vm.network "forwarded_port", guest: 80, host: "808#{i}"
node.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
node.vm.provision :shell, path: "bootstrap-nodes.sh"
config.vm.provision "shell", inline: <<-EOC
sudo sed -i -e "\\#PasswordAuthentication no# s#PasswordAuthentication no#PasswordAuthentication yes#g" /etc/ssh/sshd_config
sudo systemctl restart sshd
EOC
end
end
end