msg:"The Matrix Corporal HTTP API is enabled (`matrix_corporal_http_api_enabled`), but no auth token has been set in `matrix_corporal_http_api_auth_token`"
msg:"The Matrix Corporal HTTP API is enabled (`matrix_corporal_http_api_enabled`), but no auth token has been set in `matrix_corporal_http_api_auth_token`"
when:"matrix_corporal_http_api_enabled and matrix_corporal_http_api_auth_token == ''"
when:"matrix_corporal_http_api_enabled|bool and matrix_corporal_http_api_auth_token == ''"
# If we have found an existing version (installed from before), we use its corresponding Docker image.
# If we have found an existing version (installed from before), we use its corresponding Docker image.
# If not, we install using the latest Postgres.
# If not, we install using the latest Postgres.
@ -16,18 +16,18 @@
# Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`).
# Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`).
- set_fact:
- set_fact:
matrix_postgres_docker_image_to_use:"{{ matrix_postgres_docker_image_latest if matrix_postgres_detected_version_corresponding_docker_image == '' else matrix_postgres_detected_version_corresponding_docker_image }}"
matrix_postgres_docker_image_to_use:"{{ matrix_postgres_docker_image_latest if matrix_postgres_detected_version_corresponding_docker_image == '' else matrix_postgres_detected_version_corresponding_docker_image }}"
when:matrix_postgres_enabled
when:matrix_postgres_enabled|bool
- name:Warn if on an old version of Postgres
- name:Warn if on an old version of Postgres
debug:
debug:
msg:"NOTE: Your setup is on an old Postgres version ({{ matrix_postgres_docker_image_to_use }}), while {{ matrix_postgres_docker_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
msg:"NOTE: Your setup is on an old Postgres version ({{ matrix_postgres_docker_image_to_use }}), while {{ matrix_postgres_docker_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
when:"matrix_postgres_enabled and matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest"
when:"matrix_postgres_enabled|bool and matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest"
# Even if we don't run the internal server, we still need this for running the CLI
# Even if we don't run the internal server, we still need this for running the CLI
- name:Ensure postgres Docker image is pulled
- name:Ensure postgres Docker image is pulled
docker_image:
docker_image:
name:"{{ matrix_postgres_docker_image_to_use }}"
name:"{{ matrix_postgres_docker_image_to_use }}"
when:matrix_postgres_enabled
when:matrix_postgres_enabled|bool
# We always create these directories, even if an external Postgres is used,
# We always create these directories, even if an external Postgres is used,
# because we store environment variable files there.
# because we store environment variable files there.
@ -41,7 +41,7 @@
with_items:
with_items:
- "{{ matrix_postgres_base_path }}"
- "{{ matrix_postgres_base_path }}"
- "{{ matrix_postgres_data_path }}"
- "{{ matrix_postgres_data_path }}"
when:matrix_postgres_enabled
when:matrix_postgres_enabled|bool
- name:Ensure Postgres environment variables file created
- name:Ensure Postgres environment variables file created
when:"not matrix_postgres_enabled and matrix_postgres_service_stat.stat.exists"
when:"not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists"
- name:Ensure systemd reloaded after matrix-postgres.service removal
- name:Ensure systemd reloaded after matrix-postgres.service removal
service:
service:
daemon_reload:yes
daemon_reload:yes
when:"not matrix_postgres_enabled and matrix_postgres_service_stat.stat.exists"
when:"not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists"
- name:Check existence of matrix-postgres local data path
- name:Check existence of matrix-postgres local data path
stat:
stat:
path:"{{ matrix_postgres_data_path }}"
path:"{{ matrix_postgres_data_path }}"
register:matrix_postgres_data_path_stat
register:matrix_postgres_data_path_stat
when:"not matrix_postgres_enabled"
when:"not matrix_postgres_enabled|bool"
# We just want to notify the user. Deleting data is too destructive.
# We just want to notify the user. Deleting data is too destructive.
- name:Notify if matrix-postgres local data remains
- name:Notify if matrix-postgres local data remains
debug:
debug:
msg:"Note: You are not using a local PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_data_path }}`. Feel free to delete it."
msg:"Note: You are not using a local PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_data_path }}`. Feel free to delete it."
when:"not matrix_postgres_enabled and matrix_postgres_data_path_stat.stat.exists"
when:"not matrix_postgres_enabled|bool and matrix_postgres_data_path_stat.stat.exists"
- name:Ensure matrix-postgres-update-user-password-hash script created
- name:Ensure matrix-postgres-update-user-password-hash script created
msg:"Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}"
msg:"Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}"
when:"matrix_synapse_enabled and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)"
when:"matrix_synapse_enabled|bool and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)"
- name:Report working Matrix Client API
- name:Report working Matrix Client API
debug:
debug:
msg:"The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working"
msg:"The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working"
msg:"Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port 8448 open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}"
msg:"Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port 8448 open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}"
when:"matrix_synapse_enabled and matrix_synapse_federation_enabled and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)"
when:"matrix_synapse_enabled|bool and matrix_synapse_federation_enabled|bool and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)"
- name:Fail if Matrix Federation API unexpectedly enabled
- name:Fail if Matrix Federation API unexpectedly enabled
fail:
fail:
msg:"Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled."
msg:"Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled."
when:"matrix_synapse_enabled and not matrix_synapse_federation_enabled and not result_matrix_synapse_federation_api.failed"
when:"matrix_synapse_enabled|bool and not matrix_synapse_federation_enabled|bool and not result_matrix_synapse_federation_api.failed"
- name:Report working Matrix Federation API
- name:Report working Matrix Federation API
debug:
debug:
msg:"The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working"
msg:"The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working"
when:"matrix_synapse_enabled and matrix_synapse_federation_enabled"
when:"matrix_synapse_enabled|bool and matrix_synapse_federation_enabled|bool"