From fe0ee86319ac711ae2b835c756ed288a3cbfceee Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 8 Jan 2024 18:21:42 +0100 Subject: [PATCH] Solved reset bug --- roles/docker-discourse/handlers/main.yml | 2 +- roles/docker-discourse/tasks/main.yml | 24 ++++++++++++++++--- ...pp.yml.j2 => discourse_application.yml.j2} | 0 3 files changed, 22 insertions(+), 4 deletions(-) rename roles/docker-discourse/templates/{app.yml.j2 => discourse_application.yml.j2} (100%) diff --git a/roles/docker-discourse/handlers/main.yml b/roles/docker-discourse/handlers/main.yml index 51f3be74..83e79d85 100644 --- a/roles/docker-discourse/handlers/main.yml +++ b/roles/docker-discourse/handlers/main.yml @@ -1,5 +1,5 @@ --- - name: recreate discourse command: - cmd: ./launcher rebuild app + cmd: ./launcher rebuild discourse_application chdir: "{{discourse_repository_directory}}" diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml index 328152e1..deca9d74 100644 --- a/roles/docker-discourse/tasks/main.yml +++ b/roles/docker-discourse/tasks/main.yml @@ -12,6 +12,24 @@ - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml +- name: "stop container discourse_application" + command: + cmd: "docker stop discourse_application" + ignore_errors: true + when: reset_files | bool + +- name: "rm container discourse_application" + command: + cmd: "docker rm discourse_application" + ignore_errors: true + when: reset_files | bool + +- name: "cleanup central database from {{docker_compose_project_name}}_default network" + command: + cmd: "docker network disconnect discourse_default central-{{ database_type }}" + ignore_errors: true + when: reset_files | bool + - name: add docker-compose.yml template: src=docker-compose.yml.j2 dest={{docker_compose_instance_directory}}docker-compose.yml notify: docker compose project setup @@ -35,10 +53,10 @@ mode: '700' state: directory -- name: "copy configuration to {{discourse_repository_directory}}containers/app.yml" +- name: "copy configuration to {{discourse_repository_directory}}containers/discourse_application.yml" template: - src: app.yml.j2 - dest: "{{discourse_repository_directory}}containers/app.yml" + src: discourse_application.yml.j2 + dest: "{{discourse_repository_directory}}containers/discourse_application.yml" notify: recreate discourse - name: "add central database temporary to {{docker_compose_project_name}}_default" diff --git a/roles/docker-discourse/templates/app.yml.j2 b/roles/docker-discourse/templates/discourse_application.yml.j2 similarity index 100% rename from roles/docker-discourse/templates/app.yml.j2 rename to roles/docker-discourse/templates/discourse_application.yml.j2