mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation
This commit is contained in:
100
roles/web-app-discourse/tasks/main.yml
Normal file
100
roles/web-app-discourse/tasks/main.yml
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
|
||||
# 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: "include service-rdbms-central"
|
||||
include_role:
|
||||
name: service-rdbms-central
|
||||
when: run_once_docker_discourse is not defined
|
||||
|
||||
- name: "include role webserver-proxy-domain for {{application_id}}"
|
||||
include_role:
|
||||
name: webserver-proxy-domain
|
||||
vars:
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
when: run_once_docker_discourse is not defined
|
||||
|
||||
- name: "cleanup central database from {{application_id}}_default network"
|
||||
command:
|
||||
cmd: "docker network disconnect {{applications[application_id].network}} {{ database_host }}"
|
||||
ignore_errors: true
|
||||
when:
|
||||
- mode_reset | bool
|
||||
- run_once_docker_discourse is not defined
|
||||
|
||||
- name: add docker-compose.yml
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{docker_compose.directories.instance}}docker-compose.yml"
|
||||
notify:
|
||||
- docker compose up
|
||||
when: run_once_docker_discourse is not defined
|
||||
|
||||
- name: flush, to recreate discourse docker compose
|
||||
meta: flush_handlers
|
||||
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: "destroy container discourse_application"
|
||||
command:
|
||||
cmd: "./launcher destroy discourse_application"
|
||||
chdir: "{{docker_repository_directory }}"
|
||||
ignore_errors: true
|
||||
notify: recreate discourse
|
||||
when:
|
||||
- mode_reset | bool
|
||||
- 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: "add {{applications[application_id].container}} to network central_postgres"
|
||||
command:
|
||||
cmd: "docker network connect central_postgres {{applications[application_id].container}}"
|
||||
ignore_errors: true
|
||||
when:
|
||||
- applications | is_feature_enabled('central_database',application_id)
|
||||
- run_once_docker_discourse is not defined
|
||||
|
||||
- name: "remove central database from {{application_id}}_default"
|
||||
command:
|
||||
cmd: "docker network disconnect {{applications[application_id].network}} {{ database_host }}"
|
||||
ignore_errors: true
|
||||
when:
|
||||
- applications | is_feature_enabled('central_database',application_id)
|
||||
- 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
|
Reference in New Issue
Block a user