Parse var reference into json;Debugging between plays
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
4fdf4b22e5
commit
147304f7b1
16
playbook.yml
16
playbook.yml
@ -120,12 +120,9 @@
|
||||
cmd: kubectl config view --raw
|
||||
register: k3s_kubeconfig
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: k3s_kubeconfig.stdout
|
||||
|
||||
- name: Initial node -- Store token
|
||||
ansible.builtin.set_fact:
|
||||
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) }, { 'config': ( k3s_kubeconfig.stdout ) } ) }}"
|
||||
cluster: "{{ cluster | combine( { 'token': ( k3s_token.content | b64decode | trim ) }, { 'kubeconfig': ( k3s_kubeconfig.stdout | from_json ) } ) }}"
|
||||
|
||||
- block:
|
||||
|
||||
@ -172,16 +169,11 @@
|
||||
ansible.builtin.shell:
|
||||
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage"
|
||||
executable: /bin/bash
|
||||
register: foo
|
||||
environment:
|
||||
K3S_TOKEN: "{{ cluster.token }}" # (hostvars[ansible_play_hosts[0]]).cluster.token
|
||||
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
|
||||
throttle: 1
|
||||
|
||||
rescue:
|
||||
- ansible.builtin.debug:
|
||||
var: foo
|
||||
|
||||
when: inventory_hostname != ansible_play_hosts[0]
|
||||
|
||||
- name: Deploy applications
|
||||
@ -191,6 +183,11 @@
|
||||
- applications.k3s.yml
|
||||
tasks:
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: cluster
|
||||
- ansible.builtin.debug:
|
||||
var: hostvars
|
||||
|
||||
- name: Add Helm chart repositories
|
||||
kubernetes.core.helm_repository:
|
||||
name: "{{ item.name }}"
|
||||
@ -212,6 +209,7 @@
|
||||
namespace: fleet-system
|
||||
create_namespace: yes
|
||||
wait: yes
|
||||
kubeconfig: "{{ cluster.kubeconfig }}"
|
||||
loop:
|
||||
- name: fleet-crd
|
||||
url: "https://github.com/rancher/fleet/releases/download/{{ latest_release.json.tag_name }}/fleet-crd-{{ latest_release.json.tag_name }}.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user