-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
34 lines (29 loc) · 1.32 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
# export VAGRANT_EXPERIMENTAL="disks"
# jq -n 'range(5) | . + 1' | xargs -P10 -I {} vagrant up k3s{}.test
# jq -n 'range(5) | . + 1' | xargs -P10 -I {} vagrant reload k3s{}.test
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/me.pub"
config.vm.provision "shell", inline: <<-EOC
cat /home/vagrant/.ssh/me.pub >> /home/vagrant/.ssh/authorized_keys
sudo sed -i 's/.*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo systemctl restart sshd.service
EOC
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.network "public_network", type: "dhcp", :bridge => 'en0: Ethernet'
(1..5).each do |i|
config.vm.define "k3s#{i}.test" do |node|
node.vm.hostname = "knode#{i}.test"
node.vm.network "private_network", ip: "172.16.17.10#{i}"
# node.vm.network "public_network", ip: "192.168.178.10#{i}"
node.vm.network "private_network", ip: "fd34:fe56:7891:2f3b::#{i}"
node.vm.provider "virtualbox" do |v|
v.name = "k3s#{i}.test"
v.memory = 3072
v.cpus = 4
end
node.vm.disk :disk, name: "data", size: "150GB"
end
end
end