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

77 lines
2.4 KiB
YAML
Raw Normal View History

2023-12-08 00:34:48 +01:00
---
2024-01-05 11:13:51 +01:00
# Necessary for building: https://chat.openai.com/share/99d258cc-294b-4924-8eef-02fe419bb838
- name: install which
pacman:
name: which
state: present
2024-01-19 15:12:18 +01:00
- name: "include docker/compose/database.yml"
include_tasks: docker/compose/database.yml
2023-12-08 00:34:48 +01:00
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
2024-01-08 18:21:42 +01:00
- name: "cleanup central database from {{docker_compose_project_name}}_default network"
command:
cmd: "docker network disconnect discourse_default central-{{ database_type }}"
ignore_errors: true
2024-01-08 19:38:36 +01:00
when: mode_reset | bool
2024-01-08 18:21:42 +01:00
2024-01-05 20:16:08 +01:00
- name: add docker-compose.yml
2024-01-11 11:25:45 +01:00
template:
src: docker-compose.yml.j2
dest: "{{docker_compose_instance_directory}}docker-compose.yml"
2024-01-05 20:16:08 +01:00
notify: docker compose project setup
- name: flush, to recreate discourse docker compose
meta: flush_handlers
2023-12-08 00:34:48 +01:00
- name: pull docker repository
git:
repo: "https://github.com/discourse/discourse_docker.git"
2024-01-05 20:16:08 +01:00
dest: "{{discourse_repository_directory}}"
2023-12-08 00:34:48 +01:00
update: yes
notify: recreate discourse
become: true
ignore_errors: true
2024-01-05 20:16:08 +01:00
- name: set chmod 700 for {{discourse_repository_directory}}containers
2023-12-08 00:34:48 +01:00
ansible.builtin.file:
2024-01-05 20:16:08 +01:00
path: "{{discourse_repository_directory}}/containers"
2023-12-08 00:34:48 +01:00
mode: '700'
state: directory
2024-01-08 18:21:42 +01:00
- name: "copy configuration to {{discourse_repository_directory}}containers/discourse_application.yml"
2023-12-08 00:34:48 +01:00
template:
2024-01-08 18:21:42 +01:00
src: discourse_application.yml.j2
dest: "{{discourse_repository_directory}}containers/discourse_application.yml"
2024-01-05 20:16:08 +01:00
notify: recreate discourse
2024-01-05 20:22:34 +01:00
- name: "add central database temporary to {{docker_compose_project_name}}_default"
2024-01-05 20:16:08 +01:00
command:
2024-01-05 20:22:34 +01:00
cmd: "docker network connect discourse_default central-{{ database_type }}"
2024-01-14 01:03:39 +01:00
ignore_errors: true
2024-01-05 20:16:08 +01:00
when: enable_central_database | bool
2024-01-09 15:03:37 +01:00
- name: "destroy container discourse_application"
command:
cmd: "./launcher destroy discourse_application"
chdir: "{{discourse_repository_directory}}"
ignore_errors: true
when: mode_reset | bool
2024-01-05 20:16:08 +01:00
- name: flush, to recreate discourse app
meta: flush_handlers
2024-01-20 15:19:02 +01:00
- name: "add {{discourse_application_container}} to network central_postgres"
command:
cmd: "docker network connect central_postgres {{discourse_application_container}}"
ignore_errors: true
when: enable_central_database | bool
2024-01-09 15:03:37 +01:00
2024-01-05 20:22:34 +01:00
- name: "remove central database from {{docker_compose_project_name}}_default"
2024-01-05 20:16:08 +01:00
command:
2024-01-05 20:22:34 +01:00
cmd: "docker network disconnect discourse_default central-{{ database_type }}"
2024-01-05 20:16:08 +01:00
when: enable_central_database | bool