From 4fdf4b22e5a6c632ffbe3f9937e46ecbdeac9b75 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Mon, 25 Apr 2022 20:54:47 +0200 Subject: [PATCH] Retrieve kubeconfig --- playbook.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/playbook.yml b/playbook.yml index 2598aaa..5c62cc9 100644 --- a/playbook.yml +++ b/playbook.yml @@ -115,9 +115,17 @@ src: /var/lib/rancher/k3s/server/token register: k3s_token + - name: Initial node -- Retrieve kubeconfig + ansible.builtin.shell: + cmd: kubectl config view --raw + register: k3s_kubeconfig + + - ansible.builtin.debug: + var: k3s_kubeconfig.stdout + - name: Initial node -- Store token ansible.builtin.set_fact: - cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) } ) }}" + cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) }, { 'config': ( k3s_kubeconfig.stdout ) } ) }}" - block: @@ -155,6 +163,9 @@ retries: 3 delay: 30 + - ansible.builtin.debug: + var: cluster + - block: - name: Additional nodes -- Install K3s binary