mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-22 04:34:00 +00:00
Ensure matrix-postgres.service is started before creating additional users/databases
This commit is contained in:
parent
a374d309c8
commit
183d2a10db
@ -42,3 +42,9 @@ matrix_postgres_container_postgres_bind_port: ""
|
||||
# username: matrix_appservice_slack
|
||||
# password: some_password
|
||||
matrix_postgres_additional_databases: []
|
||||
|
||||
# The number of seconds to wait after starting `matrix-postgres.service`
|
||||
# and before trying to run queries for creating additional databases/users against it.
|
||||
#
|
||||
# For most (subsequent) runs, Postgres would already be running, so no waiting will be happening at all.
|
||||
matrix_postgres_additional_databases_postgres_start_wait_timeout_seconds: 15
|
||||
|
@ -1,10 +1,20 @@
|
||||
---
|
||||
|
||||
# TODO - we should ensure matrix-postgres.service is started.
|
||||
# .. and that if we had just started it, we've given it ample time to initialize,
|
||||
# before we attempt to run queries against it.
|
||||
- name: Ensure matrix-postgres is started
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Create additional Postgers user and database
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
timeout: "{{ matrix_postgres_additional_databases_postgres_start_wait_timeout_seconds }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "matrix_postgres_service_start_result.changed|bool"
|
||||
|
||||
- name: Create additional Postgres user and database
|
||||
include_tasks: "{{ role_path }}/tasks/util/create_additional_database.yml"
|
||||
with_items: "{{ matrix_postgres_additional_databases }}"
|
||||
loop_control:
|
||||
|
Loading…
Reference in New Issue
Block a user