From 1025b8f0763504e25d2411fca761a11340fcef44 Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer <22202402+sporqist@users.noreply.github.com> Date: Mon, 1 May 2023 00:02:56 +0000 Subject: [PATCH] =?UTF-8?q?Separater=20Handler=20f=C3=BCr=20den=20HTTP=20R?= =?UTF-8?q?esponse=20Check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/main.yaml | 12 +++++++++--- tasks/main.yaml | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/handlers/main.yaml b/handlers/main.yaml index 5299767..3b5fef5 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -13,11 +13,17 @@ project_src: /opt/gitea register: docker_compose -- name: Check Gitea HTTP Response +- name: Get Gitea HTTP Response ansible.builtin.uri: url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" - register: _result - until: _result.status == 200 + register: gitea_http_response + failed_when: 400 <= gitea_http_response.status < 500 + +- name: Wait until Gitea is up + ansible.builtin.uri: + url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" + register: gitea_http_response + until: gitea_http_response.status == 200 retries: 30 delay: 2 diff --git a/tasks/main.yaml b/tasks/main.yaml index c703a16..fcfc825 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -72,7 +72,7 @@ mode: "600" notify: - Ensure Gitea is restarted - - Check Gitea HTTP Response + - Wait until Gitea is up - name: Upload docker-compose.yaml ansible.builtin.template: @@ -83,4 +83,4 @@ notify: - Output Docker Compose State - Ensure Gitea is restarted - - Check Gitea HTTP Response + - Wait until Gitea is up