From c02a164bb9b393cece659a2592bae5c727980b94 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Tue, 26 Apr 2022 09:19:24 +0200 Subject: [PATCH] Replace API url in kubeconfig --- playbook.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/playbook.yml b/playbook.yml index d79a1a8..e9b63e6 100644 --- a/playbook.yml +++ b/playbook.yml @@ -178,6 +178,7 @@ gather_facts: false vars_files: - applications.k3s.yml + - cluster.k3s.yml tasks: - name: Initialize tempfile @@ -191,6 +192,17 @@ content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}" mode: 0600 + - name: Replace API url + ansible.builtin.replace: + path: "{{ kubeconfig.path }}" + regexp: '(server:)127\.0\.0\.1(:6443)$' + replace: "\1{{ cluster.virtualip | ansible.utils.netaddr('ipaddr') }}\2" + - ansible.builtin.slurp: + src: "{{ kubeconfig.path }}" + register: foo + - ansible.builtin.debug: + msg: "{{ foo.content | b64decode | trim }}" + - name: Add Helm chart repositories kubernetes.core.helm_repository: name: "{{ item.name }}"