Switch to slurp module
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Danny Bessems 2022-04-20 11:43:02 +02:00
parent 4e4623909e
commit 44e6a160af
1 changed files with 13 additions and 3 deletions

View File

@ -108,9 +108,19 @@
K3S_TOKEN: "{{ cluster.mastertoken | default('', true) }}"
K3S_URL: "{{ cluster.apiurl | default('', true) }}"
- name: Retrieve token & reference new cluster
ansible.builtin.set_fact:
cluster: "{{ cluster | combine( { 'mastertoken': \"{{ lookup('file', '/var/lib/rancher/k3s/server/token') }}\" }, { 'apiurl': \"https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443\" } ) }}"
- name: Reference new cluster
block:
- 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
- ansible.builtin.debug: