@ -99,6 +99,29 @@
command:
cmd : "mv {{ matrix_postgres_db_migration_request.src }} {{ matrix_postgres_db_migration_request.src }}.backup"
- block:
# We can't use `{{ role_path }}` here, neither with `import_tasks`, nor with `include_tasks`,
# because it refers to the role that included this util, and not to the role this file belongs to.
- import_tasks : "roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml"
- 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 }}"
- name : Execute additional Postgres SQL migration statements
command:
cmd : >-
{{ matrix_host_command_docker }} run
--rm
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
--network={{ matrix_docker_network }}
{{ matrix_postgres_docker_image_to_use }}
psql --host=matrix-postgres --dbname={{ matrix_postgres_db_migration_request.additional_psql_statements_db_name }} --command='{{ item }}'
with_items : "{{ matrix_postgres_db_migration_request.additional_psql_statements_list }}"
when : "matrix_postgres_db_migration_request.additional_psql_statements_list|default([])|length > 0"
- name : Inject result
set_fact:
matrix_playbook_runtime_results : |