2023-01-02 00:41:41 +01:00
|
|
|
IMAGE_NAME = "bento/ubuntu-22.04"
|
2023-01-11 19:53:24 +01:00
|
|
|
|
2023-01-02 00:50:42 +01:00
|
|
|
CONTROL_PLANES = 1
|
|
|
|
NODES = 0
|
2023-01-02 00:41:41 +01:00
|
|
|
|
2023-01-11 19:53:24 +01:00
|
|
|
ansible_groups = {
|
|
|
|
"control_planes" => [
|
|
|
|
"control-plane-[1:#{CONTROL_PLANES}]"
|
|
|
|
],
|
|
|
|
"nodes" => [
|
|
|
|
"node-[1:#{NODES}]"
|
|
|
|
],
|
|
|
|
"local_dev" => [
|
|
|
|
"control-plane-[1:#{CONTROL_PLANES}]",
|
|
|
|
"node-[1:#{NODES}]"
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
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"
|
2023-01-11 19:53:24 +01:00
|
|
|
ansible.groups = ansible_groups
|
2023-01-02 00:50:42 +01:00
|
|
|
ansible.extra_vars = {
|
2023-01-11 19:53:24 +01:00
|
|
|
node_ip: "192.168.56.#{10 + i}"
|
2023-01-02 00:50:42 +01:00
|
|
|
}
|
|
|
|
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-11 19:53:24 +01:00
|
|
|
ansible.groups = ansible_groups
|
2023-01-02 00:41:41 +01:00
|
|
|
ansible.extra_vars = {
|
|
|
|
node_ip: "192.168.56.#{20 + i}",
|
2023-01-02 00:50:42 +01:00
|
|
|
control_plane_endpoint: "192.168.56.11",
|
2023-01-02 00:41:41 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|