Replace API url in kubeconfig
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2022-04-26 09:19:24 +02:00
parent 7a9cc7cc1c
commit c02a164bb9

View File

@ -178,6 +178,7 @@
gather_facts: false gather_facts: false
vars_files: vars_files:
- applications.k3s.yml - applications.k3s.yml
- cluster.k3s.yml
tasks: tasks:
- name: Initialize tempfile - name: Initialize tempfile
@ -191,6 +192,17 @@
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}" content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
mode: 0600 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 - name: Add Helm chart repositories
kubernetes.core.helm_repository: kubernetes.core.helm_repository:
name: "{{ item.name }}" name: "{{ item.name }}"