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

69 lines
2.2 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
- 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-09 12:44:59 +01:00
- name: "destroy container discourse_application"
2024-01-08 18:21:42 +01:00
command:
2024-01-09 12:44:59 +01:00
cmd: "./launcher destroy discourse_application"
2024-01-08 18:21:42 +01:00
ignore_errors: true
2024-01-08 19:38:36 +01:00
when: mode_reset | bool
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
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
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-05 20:16:08 +01:00
when: enable_central_database | bool
- name: flush, to recreate discourse app
meta: flush_handlers
when: enable_central_database | bool
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