Replace API url in kubeconfig
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Danny Bessems 2022-04-26 09:19:24 +02:00
parent 7a9cc7cc1c
commit c02a164bb9
1 changed files with 12 additions and 0 deletions

View File

@ -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 }}"