Fix some ansible-lint-reported warnings
This mostly fixes `key-order` warnings around `block` statements.
This commit is contained in:
@ -78,7 +78,7 @@ matrix_postgres_import_roles_to_ignore: [matrix_postgres_connection_username]
|
||||
# which is unsupported by default by newer Postgres versions (v14+).
|
||||
# When users are created and passwords are set by the playbook, they end up hashed as `scram-sha-256` on Postgres v14+.
|
||||
# If an md5-hashed password is restored on top, Postgres v14+ will refuse to authenticate users with it by default.
|
||||
matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_postgres_import_roles_to_ignore | join('|') }})(;| WITH)" # noqa var-spacing
|
||||
matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_postgres_import_roles_to_ignore | join('|') }})(;| WITH)" # noqa jinja[spacing]
|
||||
|
||||
# A list of databases to avoid creating when importing (or upgrading) the database.
|
||||
# If a dump file contains the databases and they've also been created beforehand (see `matrix_postgres_additional_databases`),
|
||||
@ -86,7 +86,7 @@ matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_post
|
||||
# We either need to not create them or to ignore the `CREATE DATABASE` statements in the dump.
|
||||
matrix_postgres_import_databases_to_ignore: [matrix_postgres_db_name]
|
||||
|
||||
matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE ({{ matrix_postgres_import_databases_to_ignore | join('|') }})\\s" # noqa var-spacing
|
||||
matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE ({{ matrix_postgres_import_databases_to_ignore | join('|') }})\\s" # noqa jinja[spacing]
|
||||
|
||||
# The number of seconds to wait after starting `matrix-postgres.service`
|
||||
# and before trying to run queries for creating additional databases/users against it.
|
||||
|
@ -25,7 +25,8 @@
|
||||
# We either expect `postgres_db_connection_string` specifying a full Postgres database connection string,
|
||||
# or `postgres_connection_string_variable_name`, specifying a name of a variable, which contains a valid connection string.
|
||||
|
||||
- block:
|
||||
- when: 'postgres_connection_string_variable_name is defined'
|
||||
block:
|
||||
- name: Fail if postgres_connection_string_variable_name points to an undefined variable
|
||||
ansible.builtin.fail: msg="postgres_connection_string_variable_name is defined, but there is no variable with the name `{{ postgres_connection_string_variable_name }}`"
|
||||
when: "postgres_connection_string_variable_name not in vars"
|
||||
@ -33,7 +34,6 @@
|
||||
- name: Get Postgres connection string from variable
|
||||
ansible.builtin.set_fact:
|
||||
postgres_db_connection_string: "{{ lookup('vars', postgres_connection_string_variable_name) }}"
|
||||
when: 'postgres_connection_string_variable_name is defined'
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
|
@ -31,7 +31,8 @@
|
||||
msg: "File cannot be found on the server at {{ matrix_postgres_db_migration_request.src }}"
|
||||
when: "not matrix_postgres_db_migration_request_src_stat_result.stat.exists"
|
||||
|
||||
- block:
|
||||
- when: "matrix_postgres_pgloader_container_image_self_build | bool"
|
||||
block:
|
||||
- name: Ensure pgloader repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_postgres_pgloader_container_image_self_build_repo }}"
|
||||
@ -69,7 +70,6 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_postgres_pgloader_container_image_self_build_src_path }}"
|
||||
pull: true
|
||||
when: "matrix_postgres_pgloader_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure pgloader Docker image is pulled
|
||||
docker_image:
|
||||
@ -134,7 +134,8 @@
|
||||
register: matrix_postgres_migrate_db_to_postgres_import_result
|
||||
changed_when: matrix_postgres_migrate_db_to_postgres_import_result.rc == 0
|
||||
|
||||
- block:
|
||||
- when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([]) | length > 0"
|
||||
block:
|
||||
- ansible.builtin.import_role:
|
||||
name: matrix-postgres
|
||||
tasks_from: detect_existing_postgres_version
|
||||
@ -157,8 +158,6 @@
|
||||
register: matrix_postgres_migrate_db_to_postgres_additional_queries_result
|
||||
changed_when: matrix_postgres_migrate_db_to_postgres_additional_queries_result.rc == 0
|
||||
|
||||
when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([]) | length > 0"
|
||||
|
||||
- name: Archive {{ matrix_postgres_db_migration_request.engine_old }} database ({{ matrix_postgres_db_migration_request.src }} -> {{ matrix_postgres_db_migration_request.src }}.backup)
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ matrix_postgres_db_migration_request.src }} {{ matrix_postgres_db_migration_request.src }}.backup"
|
||||
|
@ -52,14 +52,14 @@
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: "result_pg_old_data_dir_stat.stat.exists"
|
||||
|
||||
- block:
|
||||
- when: "result_pg_old_data_dir_stat.stat.exists"
|
||||
block:
|
||||
- name: Relocate Postgres data files from old directory to new
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ item.path }} {{ matrix_postgres_data_path }}/{{ item.path | basename }}"
|
||||
with_items: "{{ result_pg_old_data_dir_find.files }}"
|
||||
register: matrix_postgres_migrate_postgres_data_directory_move_result
|
||||
changed_when: matrix_postgres_migrate_postgres_data_directory_move_result.rc == 0
|
||||
when: "result_pg_old_data_dir_stat.stat.exists"
|
||||
|
||||
# Intentionally not starting matrix-postgres here.
|
||||
# It likely needs to be updated to point to the new directory.
|
||||
|
Reference in New Issue
Block a user