From 4e30054a8f87b8f85117bdca9f23509331fd3769 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 6 Feb 2024 21:58:13 +0100 Subject: [PATCH] Optimized recreate discourse handler --- roles/docker-discourse/handlers/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/docker-discourse/handlers/main.yml b/roles/docker-discourse/handlers/main.yml index 2c3842e3..0fff661f 100644 --- a/roles/docker-discourse/handlers/main.yml +++ b/roles/docker-discourse/handlers/main.yml @@ -1,5 +1,13 @@ --- -- name: recreate discourse +- name: "stop and remove discourse container if it exist" + docker_container: + name: "{{discourse_application_container}}" + state: absent + register: container_action + failed_when: container_action.failed and 'No such container' not in container_action.msg + listen: recreate discourse +- name: rebuild discourse command: cmd: "./launcher rebuild {{discourse_application_container}}" chdir: "{{discourse_repository_directory}}" + listen: recreate discourse \ No newline at end of file