Store token as fact
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
Danny Bessems 2022-04-20 12:58:58 +02:00
parent 2d8cc987f8
commit f8046868bf
1 changed files with 13 additions and 1 deletions

View File

@ -111,10 +111,22 @@
register: k3s_token
when: inventory_hostname == ansible_play_hosts[0]
- ansible.builtin.debug:
var: k3s_token
- ansible.builtin.debug:
var: cluster
- name: Store in dictionary
ansible.builtin.set_fact:
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) } ) }}"
- ansible.builtin.debug:
var: cluster
- name: Install K3s binary (additional nodes)
ansible.builtin.shell:
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage,traefik"
environment:
K3S_TOKEN: "{{ k3s_token.content | b64decode | trim }}"
K3S_TOKEN: "{{ cluster.token }}"
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
when: inventory_hostname != ansible_play_hosts[0]