Test until-loop based on valid json being returned
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-04-22 17:52:32 +02:00
parent b50eecf441
commit 77a49b41a0

View File

@ -137,23 +137,25 @@
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 }}"
retries: 3
delay: 30
delegate_to: "{{ ansible_play_hosts[0] }}"
run_once: true
- block:
- ansible.builtin.shell:
cmd: "curl -k https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443/livez?verbose"
register: api_readycheck
ignore_errors: yes
- ansible.builtin.debug:
var: api_readycheck.stdout
- name: Additional nodes -- Wait for available API
ansible.builtin.wait_for:
host: "{{ cluster.virtualip | ansible.utils.ipaddr('address') }}"
port: 6443
timeout: 300
# - name: Additional nodes -- Wait for available API
# ansible.builtin.wait_for:
# host: "{{ cluster.virtualip | ansible.utils.ipaddr('address') }}"
# port: 6443
# timeout: 300
- name: Additional nodes -- Install K3s binary
ansible.builtin.shell:
@ -162,13 +164,6 @@
K3S_TOKEN: "{{ cluster.token }}" # (hostvars[ansible_play_hosts[0]]).cluster.token
K3S_URL: "{{ 'https://' + ( cluster.virtualip | ansible.utils.ipaddr('address') ) + ':6443' }}"
- ansible.builtin.shell:
cmd: "curl -k https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443/livez?verbose"
ignore_errors: yes
register: api_readycheck
- ansible.builtin.debug:
var: api_readycheck.stdout
rescue:
- name: Debug systemd unit