Switch to slurp module
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2022-04-20 11:43:02 +02:00
parent 4e4623909e
commit 44e6a160af

View File

@ -108,9 +108,19 @@
K3S_TOKEN: "{{ cluster.mastertoken | default('', true) }}" K3S_TOKEN: "{{ cluster.mastertoken | default('', true) }}"
K3S_URL: "{{ cluster.apiurl | default('', true) }}" K3S_URL: "{{ cluster.apiurl | default('', true) }}"
- name: Retrieve token & reference new cluster - name: Reference new cluster
ansible.builtin.set_fact: block:
cluster: "{{ cluster | combine( { 'mastertoken': \"{{ lookup('file', '/var/lib/rancher/k3s/server/token') }}\" }, { 'apiurl': \"https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443\" } ) }}"
- name: Retrieve token
ansible.builtin.slurp:
src: /var/lib/rancher/k3s/server/token
register: k3s_token
- ansible.builtin.debug:
var: k3s_token
- name: Add to dictionary
cluster: "{{ cluster | combine( { 'mastertoken': k3s_token }, { 'apiurl': \"https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443\" } ) }}"
when: cluster.mastertoken is not defined when: cluster.mastertoken is not defined
- ansible.builtin.debug: - ansible.builtin.debug: