ansible/playbooks/kubernetes/Vagrantfile

46 lines
1.5 KiB
Ruby

IMAGE_NAME = "bento/ubuntu-22.04"
CONTROL_PLANES = 1
NODES = 0
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
(1..CONTROL_PLANES).each do |i|
config.vm.define "control-plane-#{i}" do |control_plane|
control_plane.vm.box = IMAGE_NAME
control_plane.vm.network "private_network", ip: "192.168.56.#{10 + i}"
control_plane.vm.hostname = "control-plane-#{i}"
control_plane.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yaml"
ansible.extra_vars = {
cluster_name: "gerar",
node_ip: "192.168.56.#{10 + i}",
is_control_plane: true,
}
end
end
end
(1..NODES).each do |i|
config.vm.define "node-#{i}" do |node|
node.vm.box = IMAGE_NAME
node.vm.network "private_network", ip: "192.168.56.#{20 + i}"
node.vm.hostname = "node-#{i}"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yaml"
ansible.extra_vars = {
cluster_name: "gerar",
node_ip: "192.168.56.#{20 + i}",
is_control_plane: false,
control_plane_endpoint: "192.168.56.11",
}
end
end
end
end