From 6b1d8985183f2af31104f0d08ff40bd68d058dbe Mon Sep 17 00:00:00 2001 From: Mustafa <63203400+MooseStack@users.noreply.github.com> Date: Wed, 7 Oct 2026 15:51:43 -0500 Subject: [PATCH] fix: fall back to localhost when api_endpoint is unreachable (#558) Signed-off-by: Mustafa Bell <63203400+MooseStack@users.noreply.github.com> --- roles/k3s_server/tasks/main.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/k3s_server/tasks/main.yml b/roles/k3s_server/tasks/main.yml index 4818d00..0eb6e1c 100644 --- a/roles/k3s_server/tasks/main.yml +++ b/roles/k3s_server/tasks/main.yml @@ -334,12 +334,22 @@ changed_when: false - name: Wait for control plane to be ready - ansible.builtin.wait_for: - host: "{{ api_endpoint }}" - port: "{{ api_port }}" - timeout: 60 run_once: true - changed_when: false + block: + - name: Wait for control plane using api_endpoint + ansible.builtin.wait_for: + host: "{{ api_endpoint }}" + port: "{{ api_port }}" + timeout: 60 + changed_when: false + + rescue: + - name: Wait for control plane using localhost + ansible.builtin.wait_for: + host: localhost + port: "{{ api_port }}" + timeout: 60 + changed_when: false - name: Wait for the servers started so far to be etcd voters when: