From e4d723ed30abafdd2b1623c5afc15fc3747a933b Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer <22202402+sporqist@users.noreply.github.com> Date: Sat, 29 Apr 2023 14:56:41 +0000 Subject: [PATCH] verschiebe Gitea start und Erreichbarkeitscheck --- .ansible-lint-ignore | 2 +- tasks/main.yaml | 35 ++++++++--------------------------- tasks/start.yaml | 12 ++++++++++++ 3 files changed, 21 insertions(+), 28 deletions(-) create mode 100644 tasks/start.yaml diff --git a/.ansible-lint-ignore b/.ansible-lint-ignore index da7d420..2bd0723 100644 --- a/.ansible-lint-ignore +++ b/.ansible-lint-ignore @@ -3,4 +3,4 @@ # Warnungen und Fehler von ansible-lint ignoriert werden. tasks/main.yaml no-handler # Der Restart / Recreate Gitea Task ist gut dort, wo er ist -tasks/main.yaml name[template] # Es braucht zwei Templates, um den FQDN zusammenzusetzen. +tasks/start.yaml name[template] # Es braucht zwei Templates, um den FQDN zusammenzusetzen. diff --git a/tasks/main.yaml b/tasks/main.yaml index 9298d49..557a943 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -74,21 +74,9 @@ mode: "600" register: gitea_container - - name: Start Gitea - community.docker.docker_compose: - project_src: /opt/gitea - register: docker_compose - - - ansible.builtin.debug: - var: docker_compose - - - name: Check if {{ gitea.hostname }}.{{ gitea.domain }} is available and returning status 200 - ansible.builtin.uri: - url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" - register: _result - until: _result.status == 200 - retries: 30 - delay: 2 + - name: Start Gitea and try reaching it + ansible.builtin.include_tasks: + file: start.yaml rescue: - name: Stop Gitea for Backup @@ -104,17 +92,10 @@ remote_src: true mode: "700" - - name: Create / Recreate Gitea - community.docker.docker_compose: - project_src: /opt/gitea - state: present - restarted: true + - name: Start Gitea and try reaching it + ansible.builtin.include_tasks: + file: start.yaml always: - - name: Check if {{ gitea.hostname }}.{{ gitea.domain }} is available and returning status 200 - ansible.builtin.uri: - url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" - register: _result - until: _result.status == 200 - retries: 30 - delay: 2 + - ansible.builtin.debug: + var: docker_compose diff --git a/tasks/start.yaml b/tasks/start.yaml new file mode 100644 index 0000000..27e37b9 --- /dev/null +++ b/tasks/start.yaml @@ -0,0 +1,12 @@ +- name: Start Gitea + community.docker.docker_compose: + project_src: /opt/gitea + register: docker_compose + +- name: Check if {{ gitea.hostname }}.{{ gitea.domain }} is available and returning status 200 + ansible.builtin.uri: + url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" + register: _result + until: _result.status == 200 + retries: 30 + delay: 2