mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-08 19:57:35 +01:00
51312b8250
As suggested in #63 (Github issue), splitting the playbook's logic into multiple roles will be beneficial for maintainability. This patch realizes this split. Still, some components affect others, so the roles are not really independent of one another. For example: - disabling mxisd (`matrix_mxisd_enabled: false`), causes Synapse and riot-web to reconfigure themselves with other (public) Identity servers. - enabling matrix-corporal (`matrix_corporal_enabled: true`) affects how reverse-proxying (by `matrix-nginx-proxy`) is done, in order to put matrix-corporal's gateway server in front of Synapse We may be able to move away from such dependencies in the future, at the expense of a more complicated manual configuration, but it's probably not worth sacrificing the convenience we have now. As part of this work, the way we do "start components" has been redone now to use a loop, as suggested in #65 (Github issue). This should make restarting faster and more reliable.
46 lines
2.0 KiB
YAML
46 lines
2.0 KiB
YAML
---
|
|
|
|
# This utility aims to determine if there is some existing Postgres version in use or not.
|
|
# If there is, it also tries to detect the Docker image that corresponds to that version.
|
|
|
|
- name: Initialize Postgres version determination variables (default to empty)
|
|
set_fact:
|
|
matrix_postgres_detection_pg_version_path: "{{ matrix_postgres_data_path }}/PG_VERSION"
|
|
matrix_postgres_detected_existing: false
|
|
matrix_postgres_detected_version: ""
|
|
matrix_postgres_detected_version_corresponding_docker_image: ""
|
|
|
|
- name: Determine existing Postgres version (check PG_VERSION file)
|
|
stat:
|
|
path: "{{ matrix_postgres_detection_pg_version_path }}"
|
|
register: result_pg_version_stat
|
|
|
|
- set_fact:
|
|
matrix_postgres_detected_existing: true
|
|
when: "result_pg_version_stat.stat.exists"
|
|
|
|
- name: Determine existing Postgres version (read PG_VERSION file)
|
|
slurp:
|
|
src: "{{ matrix_postgres_detection_pg_version_path }}"
|
|
register: result_pg_version
|
|
when: "matrix_postgres_detected_existing"
|
|
|
|
- name: Determine existing Postgres version (make sense of PG_VERSION file)
|
|
set_fact:
|
|
matrix_postgres_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}"
|
|
when: "matrix_postgres_detected_existing"
|
|
|
|
- name: Determine corresponding Docker image to detected version (assume default of latest)
|
|
set_fact:
|
|
matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_latest }}"
|
|
when: "matrix_postgres_detected_version != ''"
|
|
|
|
- name: Determine corresponding Docker image to detected version (use 9.x, if detected)
|
|
set_fact:
|
|
matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v9 }}"
|
|
when: "matrix_postgres_detected_version.startswith('9.')"
|
|
|
|
- name: Determine corresponding Docker image to detected version (use 10.x, if detected)
|
|
set_fact:
|
|
matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v10 }}"
|
|
when: "matrix_postgres_detected_version == '10' or matrix_postgres_detected_version.startswith('10.')" |