Avoid dictionary for now; enable facts
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Danny Bessems 2022-04-20 15:13:04 +02:00
parent c6a0490af7
commit d9b07235eb
1 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@
- name: Provision Kubernetes
hosts: k3s_ha
gather_facts: false
gather_facts: true
vars_files:
- cluster.k3s.yml
tasks:
@ -112,9 +112,9 @@
src: /var/lib/rancher/k3s/server/token
register: k3s_token
- name: Store in dictionary
- name: Store token
ansible.builtin.set_fact:
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) } ) }}"
clustertoken: "{{ k3s_token.content | b64decode | trim }}"
- name: Pull 'kube-vip' image
ansible.builtin.shell:
@ -137,7 +137,7 @@
ansible.builtin.shell:
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage,traefik"
environment:
K3S_TOKEN: "{{ hostvars[ansible_play_hosts[0]].cluster.token }}"
K3S_TOKEN: "{{ hostvars[ansible_play_hosts[0]]['clustertoken'] }}"
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
when: inventory_hostname != ansible_play_hosts[0]