From ab0c96c5e1d011fe837417959b999f94735f2e55 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 20 Apr 2022 12:15:04 +0200 Subject: [PATCH] Avoid casting to string --- playbook.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/playbook.yml b/playbook.yml index 36b0595..8ac6a46 100644 --- a/playbook.yml +++ b/playbook.yml @@ -101,6 +101,9 @@ serial: 1 tasks: + - ansible.builtin.debug: + var: cluster + - name: Install K3s binary ansible.builtin.shell: cmd: "curl -sfL https://get.k3s.io | sh -s - server --cluster-init --disable local-storage,traefik --tls-san {{ cluster.virtualip | ansible.utils.ipaddr('address') }}" @@ -116,13 +119,13 @@ src: /var/lib/rancher/k3s/server/token register: k3s_token - - name: Add to dictionary + - name: Update dictionary ansible.builtin.set_fact: cluster: >- - "{{ cluster | combine( - { 'mastertoken': ( k3s_token.content | b64decode ) }, + cluster | combine( + { 'mastertoken': ( k3s_token.content | b64decode | trim ) }, { 'apiurl': 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' } - ) }}" + ) when: cluster.mastertoken is not defined