From 991882a7b13c3f155dbaa7a977ecb60d85c935b3 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Fri, 22 Apr 2022 18:07:50 +0200 Subject: [PATCH] Split up tasks (avoid jinja templating in conditionals) --- playbook.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/playbook.yml b/playbook.yml index c8caa1f..9df362b 100644 --- a/playbook.yml +++ b/playbook.yml @@ -137,12 +137,20 @@ src: kube-vip.j2 dest: /var/lib/rancher/k3s/server/manifests/kube-vip.yml - - name: Initial node -- Wait for available API - ansible.builtin.shell: - cmd: "curl -k https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443/livez?verbose" - register: api_readycheck - ignore_errors: yes - until: "{{ ( api_readycheck.stdout | from_json ).apiVersion is defined }}" + - block: + + - name: Initial node -- Test API + ansible.builtin.shell: + cmd: "curl -k https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443/livez?verbose" + register: api_readycheck + ignore_errors: yes + + - name: Initial node -- Check for valid output + ansible.builtin.set_fact: + api_validoutput: "{{ ( api_readycheck.stdout | from_json ) }}" + ignore_errors: yes + + until: api_validoutput.apiVersion is defined retries: 3 delay: 30