From a4e7ad5566dd1292d59fd3e831b6d04e32ae3a7e Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 21 Jan 2019 08:34:49 +0200 Subject: [PATCH] Use async Ansible task for importing Postgres A long-running import task may hit the SSH timeout value and die. Using async is supposed to improve reliability in such scenarios. --- roles/matrix-postgres/tasks/import_postgres.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/matrix-postgres/tasks/import_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index aed8f686..66b20a64 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -30,6 +30,11 @@ postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" +- name: Set postgres_import_wait_time, if not provided + set_fact: + postgres_import_wait_time: "{{ 7 * 86400 }}" + when: "postgres_import_wait_time|default('') == ''" + # Actual import work - name: Ensure matrix-postgres is started @@ -74,3 +79,5 @@ - name: Perform Postgres database import command: "{{ matrix_postgres_import_command }}" + async: "{{ postgres_import_wait_time }}" + poll: 10