Fix some ansible-lint-reported warnings
This mostly fixes `key-order` warnings around `block` statements.
This commit is contained in:
@ -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