Skip to content
Snippets Groups Projects
Commit 764bb4db authored by Peter Toth's avatar Peter Toth
Browse files

Vagrantfile

parent b9f301ed
No related branches found
No related tags found
No related merge requests found
Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-timezone")
config.timezone.value = "Europe/Vienna"
end
# https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=virtualbox&q=jammy
config.vm.box = "ubuntu/jammy64"
config.vm.box_version = "20221120.0.0"
config.vm.box_url = "ubuntu/jammy64"
WORKERNODES = 2
config.vm.define "master-node" do |m|
m.vm.hostname = "master-node"
m.vm.network "private_network", ip: "192.168.56.10"
m.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "2048"
vb.name = "master-node"
end
# the shell part of the k8s here
m.vm.provision "setup-hosts", :type => "shell", :path => "k8s-setup-master.sh" do |s|
end #of the shell part
m.vm.provision "setup-user", :type => "shell", :path => "adduser-sysopans.sh" do |s|
end #of the shell part
m.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("/home/master/.ssh/sysopans-id_rsa.pub").first.strip
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/sysopans/.ssh/authorized_keys
SHELL
end
m.vm.provision "setup-user-perm", :type => "shell", :path => "setpermission-sysopans.sh" do |s|
end #of the shell part
# m.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y nginx
# SHELL
end # master-node
(1..WORKERNODES).each do |i|
# worker-nodeX:
config.vm.define "worker-node#{i}" do |w|
w.vm.hostname = "worker-node#{i}"
w.vm.network "private_network", ip: "192.168.56.#{10+i}"
w.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "1024"
vb.name = "worker-node#{i}"
end
# the shell part of the k8s here
w.vm.provision "setup-hosts", :type => "shell", :path => "k8s-setup-master.sh" do |s|
end #of the shell part
w.vm.provision "setup-user", :type => "shell", :path => "adduser-sysopans.sh" do |s|
end #of the shell part
w.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("/home/master/.ssh/sysopans-id_rsa.pub").first.strip
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/sysopans/.ssh/authorized_keys
SHELL
end
w.vm.provision "setup-user-perm", :type => "shell", :path => "setpermission-sysopans.sh" do |s|
end #of the shell part
# w.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y nginx
# SHELL
end # worker-nodeX
end # loop
# hapr-node:
config.vm.define "hapr-node" do |h|
h.vm.hostname = "hapr-node"
h.vm.network "private_network", ip: "192.168.56.9"
h.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "1024"
vb.name = "hapr-node"
end
h.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y haproxy
SHELL
h.vm.provision "setup-user", :type => "shell", :path => "adduser-sysopans.sh" do |s|
end #of the shell part
h.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("/home/master/.ssh/sysopans-id_rsa.pub").first.strip
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/sysopans/.ssh/authorized_keys
SHELL
end
h.vm.provision "setup-user-perm", :type => "shell", :path => "setpermission-sysopans.sh" do |s|
end #of the shell part
end # hapr-node
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment