computer-playbook/roles/docker-discourse/tasks/main.yml

75 lines
2.3 KiB
YAML

---
# Necessary for building: https://chat.openai.com/share/99d258cc-294b-4924-8eef-02fe419bb838
- name: install which
pacman:
name: which
state: present
- name: "include docker-compose-database.yml"
include_tasks: docker-compose-database.yml
- 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
- name: flush, to recreate discourse docker compose
meta: flush_handlers
when: enable_central_database | bool
- name: pull docker repository
git:
repo: "https://github.com/discourse/discourse_docker.git"
dest: "{{discourse_repository_directory}}"
update: yes
notify: recreate discourse
become: true
ignore_errors: true
- name: set chmod 700 for {{discourse_repository_directory}}containers
ansible.builtin.file:
path: "{{discourse_repository_directory}}/containers"
mode: '700'
state: directory
- name: "copy configuration to {{discourse_repository_directory}}containers/discourse_application.yml"
template:
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"
command:
cmd: "docker network connect discourse_default central-{{ database_type }}"
when: enable_central_database | bool
- name: flush, to recreate discourse app
meta: flush_handlers
when: enable_central_database | bool
- name: "remove central database from {{docker_compose_project_name}}_default"
command:
cmd: "docker network disconnect discourse_default central-{{ database_type }}"
when: enable_central_database | bool