From f8dd48901f6193a0674986e6af55e1a96a11ec4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Rodr=C3=ADguez?= Date: Mon, 28 Oct 2024 13:12:46 +0100 Subject: [PATCH] modificados ficheros para usar virtualbox --- Vagrantfile | 24 +++++++----------------- Vagrantfile_kvm | 34 ++++++++++++++++++++++++++++++++++ ansible/hosts | 14 +++++++------- ansible/hosts_kvm | 24 ++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 Vagrantfile_kvm create mode 100644 ansible/hosts_kvm diff --git a/Vagrantfile b/Vagrantfile index d7e1761..9e8f935 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,34 +1,24 @@ Vagrant.configure("2") do |config| config.vm.box = "debian/bookworm64" config.vm.box_check_update = false - config.vm.synced_folder ".", "/vagrant", disabled: true - config.vm.provider "libvirt" do |v| - v.memory = 4096 - v.cpus = 4 - v.driver = "qemu" + config.vm.synced_folder '.', '/vagrant', disabled: true + config.vm.provider "virtualbox" do |v| + v.memory = 1024 + v.cpus = 2 end config.vm.define "plano-control" do |pcontrol| pcontrol.vm.hostname = "plano-control" pcontrol.vm.network "private_network", - :libvirt__network_name => "k3s-vagrant", - :ip => "10.10.10.10", - :libvirt__dhcp_enabled => false, - :libvirt__forward_mode => "veryisolated" + ip: "192.168.56.10" end config.vm.define "nodo1" do |nodo1| nodo1.vm.hostname = "nodo1" nodo1.vm.network "private_network", - :libvirt__network_name => "k3s-vagrant", - :ip => "10.10.10.20", - :libvirt__dhcp_enabled => false, - :libvirt__forward_mode => "veryisolated" + ip: "192.168.56.20" end config.vm.define "nodo2" do |nodo2| nodo2.vm.hostname = "nodo2" nodo2.vm.network "private_network", - :libvirt__network_name => "k3s-vagrant", - :ip => "10.10.10.30", - :libvirt__dhcp_enabled => false, - :libvirt__forward_mode => "veryisolated" + ip: "192.168.56.30" end end diff --git a/Vagrantfile_kvm b/Vagrantfile_kvm new file mode 100644 index 0000000..d7e1761 --- /dev/null +++ b/Vagrantfile_kvm @@ -0,0 +1,34 @@ +Vagrant.configure("2") do |config| + config.vm.box = "debian/bookworm64" + config.vm.box_check_update = false + config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.provider "libvirt" do |v| + v.memory = 4096 + v.cpus = 4 + v.driver = "qemu" + end + config.vm.define "plano-control" do |pcontrol| + pcontrol.vm.hostname = "plano-control" + pcontrol.vm.network "private_network", + :libvirt__network_name => "k3s-vagrant", + :ip => "10.10.10.10", + :libvirt__dhcp_enabled => false, + :libvirt__forward_mode => "veryisolated" + end + config.vm.define "nodo1" do |nodo1| + nodo1.vm.hostname = "nodo1" + nodo1.vm.network "private_network", + :libvirt__network_name => "k3s-vagrant", + :ip => "10.10.10.20", + :libvirt__dhcp_enabled => false, + :libvirt__forward_mode => "veryisolated" + end + config.vm.define "nodo2" do |nodo2| + nodo2.vm.hostname = "nodo2" + nodo2.vm.network "private_network", + :libvirt__network_name => "k3s-vagrant", + :ip => "10.10.10.30", + :libvirt__dhcp_enabled => false, + :libvirt__forward_mode => "veryisolated" + end + end diff --git a/ansible/hosts b/ansible/hosts index 308ea07..410ae44 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -3,22 +3,22 @@ all: planos_control: hosts: p_nodo: - ansible_ssh_host: 192.168.121.234 + ansible_ssh_host: 192.168.56.10 ansible_ssh_user: vagrant - ansible_ssh_private_key_file: ../.vagrant/machines/plano-control/libvirt/private_key + ansible_ssh_private_key_file: ../.vagrant/machines/plano-control/virtualbox/private_key trabajadores: hosts: nodo1: - ansible_ssh_host: 192.168.121.157 + ansible_ssh_host: 192.168.56.20 ansible_ssh_user: vagrant - ansible_ssh_private_key_file: ../.vagrant/machines/nodo1/libvirt/private_key + ansible_ssh_private_key_file: ../.vagrant/machines/nodo1/virtualbox/private_key nodo2: - ansible_ssh_host: 192.168.121.33 + ansible_ssh_host: 192.168.56.30 ansible_ssh_user: vagrant - ansible_ssh_private_key_file: ../.vagrant/machines/nodo2/libvirt/private_key + ansible_ssh_private_key_file: ../.vagrant/machines/nodo2/virtualbox/private_key vars: fichero: "/home/vagrant/k3s.sh" token_k3s: "" token_k3s_base64: "" - ip_pcontrol: "10.10.10.10" \ No newline at end of file + ip_pcontrol: "10.10.10.10" diff --git a/ansible/hosts_kvm b/ansible/hosts_kvm new file mode 100644 index 0000000..ec67cd7 --- /dev/null +++ b/ansible/hosts_kvm @@ -0,0 +1,24 @@ +all: + children: + planos_control: + hosts: + p_nodo: + ansible_ssh_host: 192.168.121.234 + ansible_ssh_user: vagrant + ansible_ssh_private_key_file: ../.vagrant/machines/plano-control/libvirt/private_key + trabajadores: + hosts: + nodo1: + ansible_ssh_host: 192.168.121.157 + ansible_ssh_user: vagrant + ansible_ssh_private_key_file: ../.vagrant/machines/nodo1/libvirt/private_key + nodo2: + ansible_ssh_host: 192.168.121.33 + ansible_ssh_user: vagrant + ansible_ssh_private_key_file: ../.vagrant/machines/nodo2/libvirt/private_key + + vars: + fichero: "/home/vagrant/k3s.sh" + token_k3s: "" + token_k3s_base64: "" + ip_pcontrol: "10.10.10.10"