2023-01-02 00:41:41 +01:00
|
|
|
IMAGE_NAME = "bento/ubuntu-22.04"
|
2023-01-02 00:50:42 +01:00
|
|
|
CONTROL_PLANES = 1
|
|
|
|
NODES = 0
|
2023-01-02 00:41:41 +01:00
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.ssh.insert_key = false
|
|
|
|
|
|
|
|
config.vm.provider "virtualbox" do |v|
|
|
|
|
v.memory = 2048
|
|
|
|
v.cpus = 2
|
|
|
|
end
|
|
|
|
|
2023-01-02 00:50:42 +01:00
|
|
|
(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
|
2023-01-02 00:41:41 +01:00
|
|
|
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|
|
2023-01-02 00:50:42 +01:00
|
|
|
ansible.playbook = "playbook.yaml"
|
2023-01-02 00:41:41 +01:00
|
|
|
ansible.extra_vars = {
|
|
|
|
cluster_name: "gerar",
|
|
|
|
node_ip: "192.168.56.#{20 + i}",
|
2023-01-02 00:50:42 +01:00
|
|
|
is_control_plane: false,
|
|
|
|
control_plane_endpoint: "192.168.56.11",
|
2023-01-02 00:41:41 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|