--- - name: "reset (if enabled)" include_tasks: reset.yml when: mode_reset | bool and run_once_docker_discourse is not defined # Necessary for building: https://chat.openai.com/share/99d258cc-294b-4924-8eef-02fe419bb838 - name: install which pacman: name: which state: present when: run_once_docker_discourse is not defined - name: "load docker, db and proxy for {{application_id}}" include_role: name: cmp-db-docker-proxy when: run_once_docker_discourse is not defined - name: pull docker repository git: repo: "https://github.com/discourse/discourse_docker.git" dest: "{{docker_repository_directory }}" update: yes notify: recreate discourse become: true ignore_errors: true when: run_once_docker_discourse is not defined - name: set chmod 700 for {{docker_repository_directory }}containers ansible.builtin.file: path: "{{docker_repository_directory }}/containers" mode: '700' state: directory when: run_once_docker_discourse is not defined - name: "copy configuration to {{discourse_application_yml_destination}}" template: src: discourse_application.yml.j2 dest: "{{discourse_application_yml_destination}}" notify: recreate discourse when: run_once_docker_discourse is not defined - name: flush, to recreate discourse app meta: flush_handlers when: run_once_docker_discourse is not defined - name: "Connect {{ applications | get_app_conf(application_id, 'container', True) }} to network {{ applications['svc-db-postgres'].network }}" command: > docker network connect {{ applications['svc-db-postgres'].network }} {{ applications | get_app_conf(application_id, 'container', True) }} register: network_connect failed_when: > network_connect.rc != 0 and 'Error response from daemon: endpoint with name {{ applications | get_app_conf(application_id, 'container', True) }} already exists in network {{ applications["svc-db-postgres"].network }}' not in network_connect.stderr changed_when: network_connect.rc == 0 when: - applications | get_app_conf(application_id, 'features.central_database', False) - run_once_docker_discourse is not defined - name: "Remove {{ applications | get_app_conf(application_id, 'network', True) }} from {{ database_host }}" command: > docker network disconnect {{ applications | get_app_conf(application_id, 'network', True) }} {{ database_host }} register: network_disconnect failed_when: > network_disconnect.rc != 0 and 'is not connected to network {{ applications | get_app_conf(application_id, 'network', True) }}' not in network_disconnect.stderr changed_when: network_disconnect.rc == 0 when: - applications | get_app_conf(application_id, 'features.central_database', False) - run_once_docker_discourse is not defined - name: run the docker_discourse tasks once set_fact: run_once_docker_discourse: true when: run_once_docker_discourse is not defined