Store kubeconfig in tempfile;Reference tempfile
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
a53b3c67b7
commit
7a9cc7cc1c
21
playbook.yml
21
playbook.yml
@ -122,7 +122,7 @@
|
||||
|
||||
- name: Initial node -- Store token
|
||||
ansible.builtin.set_fact:
|
||||
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) }, { 'kubeconfig': ( k3s_kubeconfig.stdout | from_yaml ) } ) }}"
|
||||
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) }, { 'kubeconfig': ( k3s_kubeconfig.stdout ) } ) }}"
|
||||
|
||||
- block:
|
||||
|
||||
@ -180,13 +180,16 @@
|
||||
- applications.k3s.yml
|
||||
tasks:
|
||||
|
||||
- name: Retrieve cluster dict from initial node
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ hostvars | dict2items }}"
|
||||
- ansible.builtin.set_fact:
|
||||
cluster: "{{ ( lookup('dict', hostvars) )[0].value.cluster }}"
|
||||
- ansible.builtin.debug:
|
||||
var: cluster
|
||||
- name: Initialize tempfile
|
||||
ansible.builtin.tempfile:
|
||||
state: file
|
||||
register: kubeconfig
|
||||
|
||||
- name: Store kubeconfig in tempfile
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ kubeconfig.path }}"
|
||||
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
|
||||
mode: 0600
|
||||
|
||||
- name: Add Helm chart repositories
|
||||
kubernetes.core.helm_repository:
|
||||
@ -209,7 +212,7 @@
|
||||
namespace: fleet-system
|
||||
create_namespace: yes
|
||||
wait: yes
|
||||
kubeconfig: "{{ cluster.kubeconfig }}"
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
loop:
|
||||
- name: fleet-crd
|
||||
url: "https://github.com/rancher/fleet/releases/download/{{ latest_release.json.tag_name }}/fleet-crd-{{ latest_release.json.tag_name }}.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user