diff --git a/playbook.yml b/playbook.yml index 54613f3..c8caa1f 100644 --- a/playbook.yml +++ b/playbook.yml @@ -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