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
|
cmd: kubectl config view --raw
|
||||||
register: k3s_kubeconfig
|
register: k3s_kubeconfig
|
||||||
|
|
||||||
- ansible.builtin.debug:
|
|
||||||
var: k3s_kubeconfig.stdout
|
|
||||||
|
|
||||||
- name: Initial node -- Store token
|
- name: Initial node -- Store token
|
||||||
ansible.builtin.set_fact:
|
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:
|
- block:
|
||||||
|
|
||||||
@ -172,16 +169,11 @@
|
|||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage"
|
cmd: "curl -sfL https://get.k3s.io | sh -s - server --disable local-storage"
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: foo
|
|
||||||
environment:
|
environment:
|
||||||
K3S_TOKEN: "{{ cluster.token }}" # (hostvars[ansible_play_hosts[0]]).cluster.token
|
K3S_TOKEN: "{{ cluster.token }}" # (hostvars[ansible_play_hosts[0]]).cluster.token
|
||||||
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
|
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
|
||||||
throttle: 1
|
throttle: 1
|
||||||
|
|
||||||
rescue:
|
|
||||||
- ansible.builtin.debug:
|
|
||||||
var: foo
|
|
||||||
|
|
||||||
when: inventory_hostname != ansible_play_hosts[0]
|
when: inventory_hostname != ansible_play_hosts[0]
|
||||||
|
|
||||||
- name: Deploy applications
|
- name: Deploy applications
|
||||||
@ -191,6 +183,11 @@
|
|||||||
- applications.k3s.yml
|
- applications.k3s.yml
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
|
- ansible.builtin.debug:
|
||||||
|
var: cluster
|
||||||
|
- ansible.builtin.debug:
|
||||||
|
var: hostvars
|
||||||
|
|
||||||
- name: Add Helm chart repositories
|
- name: Add Helm chart repositories
|
||||||
kubernetes.core.helm_repository:
|
kubernetes.core.helm_repository:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
@ -212,6 +209,7 @@
|
|||||||
namespace: fleet-system
|
namespace: fleet-system
|
||||||
create_namespace: yes
|
create_namespace: yes
|
||||||
wait: yes
|
wait: yes
|
||||||
|
kubeconfig: "{{ cluster.kubeconfig }}"
|
||||||
loop:
|
loop:
|
||||||
- name: fleet-crd
|
- name: fleet-crd
|
||||||
url: "https://github.com/rancher/fleet/releases/download/{{ latest_release.json.tag_name }}/fleet-crd-{{ latest_release.json.tag_name }}.tgz"
|
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