From dcb51abb171a170305c9d62ed4700fbb08bf0374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Rodr=C3=ADguez?= Date: Wed, 30 Oct 2024 08:05:02 +0100 Subject: [PATCH] =?UTF-8?q?soluci=C3=B3n=20de=20errores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/hosts | 2 +- ansible/site.yaml | 20 ++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ansible/hosts b/ansible/hosts index 410ae44..8fd7101 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -21,4 +21,4 @@ all: fichero: "/home/vagrant/k3s.sh" token_k3s: "" token_k3s_base64: "" - ip_pcontrol: "10.10.10.10" + ip_pcontrol: "192.168.56.10" diff --git a/ansible/site.yaml b/ansible/site.yaml index c61dae5..e1509fd 100644 --- a/ansible/site.yaml +++ b/ansible/site.yaml @@ -7,24 +7,12 @@ apt: pkg: - curl - - name: Descargar instalador k3s - get_url: - url: https://get.k3s.io - dest: "{{ fichero }}" - - name: Dar permisos de ejecuciĆ³n al instalador k3s - file: - path: "{{ fichero }}" - mode: '0755' - - name: Ejecutar instalador k3s - shell: "{{ fichero }}" - - name: Borrar instalador k3s - file: - path: "{{ fichero }}" - state: absent - hosts: planos_control become: true tasks: + - name: instalamos k3s + shell: "curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='--tls-san {{ ip_pcontrol }}' sh -" - name: sacar token ansible.builtin.slurp: src: "/var/lib/rancher/k3s/server/node-token" @@ -37,5 +25,5 @@ - hosts: trabajadores become: true tasks: - - name: Ejecutar instalador k3s - shell: "k3s agent --server https://{{ ip_pcontrol }}:6443 --token {{ token_k3s }}" + - name: instalamos k3s con el token + shell: "curl -sfL https://get.k3s.io | K3S_URL=https://{{ ip_pcontrol }}:6443 K3S_TOKEN={{ hostvars['p_nodo'].token_k3s }} sh -"