Avoid dictionary for now; enable facts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c6a0490af7
commit
d9b07235eb
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
- name: Provision Kubernetes
|
- name: Provision Kubernetes
|
||||||
hosts: k3s_ha
|
hosts: k3s_ha
|
||||||
gather_facts: false
|
gather_facts: true
|
||||||
vars_files:
|
vars_files:
|
||||||
- cluster.k3s.yml
|
- cluster.k3s.yml
|
||||||
tasks:
|
tasks:
|
||||||
@ -112,9 +112,9 @@
|
|||||||
src: /var/lib/rancher/k3s/server/token
|
src: /var/lib/rancher/k3s/server/token
|
||||||
register: k3s_token
|
register: k3s_token
|
||||||
|
|
||||||
- name: Store in dictionary
|
- name: Store token
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) } ) }}"
|
clustertoken: "{{ k3s_token.content | b64decode | trim }}"
|
||||||
|
|
||||||
- name: Pull 'kube-vip' image
|
- name: Pull 'kube-vip' image
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
@ -137,7 +137,7 @@
|
|||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage,traefik"
|
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage,traefik"
|
||||||
environment:
|
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' }}"
|
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
|
||||||
|
|
||||||
when: inventory_hostname != ansible_play_hosts[0]
|
when: inventory_hostname != ansible_play_hosts[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user