mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-10-19 22:53:23 +00:00
More ansible-lint fixes
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
- name: Fail if Postgres not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import."
|
||||
when: "not matrix_postgres_enabled|bool"
|
||||
when: "not matrix_postgres_enabled | bool"
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
@@ -13,7 +13,7 @@
|
||||
when: "server_path_postgres_dump is not defined or server_path_postgres_dump.startswith('<')"
|
||||
|
||||
- name: Check if the provided Postgres dump file exists
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ server_path_postgres_dump }}"
|
||||
register: result_server_path_postgres_dump_stat
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
- name: Set postgres_start_wait_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
when: "postgres_start_wait_time | default('') == ''"
|
||||
|
||||
- name: Set postgres_import_wait_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
postgres_import_wait_time: "{{ 7 * 86400 }}"
|
||||
when: "postgres_import_wait_time|default('') == ''"
|
||||
when: "postgres_import_wait_time | default('') == ''"
|
||||
|
||||
# By default, we connect and import into the main (`matrix`) database.
|
||||
# Single-database dumps for Synapse may wish to import into `synapse` instead.
|
||||
- name: Set postgres_default_import_database, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
postgres_default_import_database: "{{ matrix_postgres_db_name }}"
|
||||
when: "postgres_default_import_database|default('') == ''"
|
||||
when: "postgres_default_import_database | default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
@@ -51,17 +51,17 @@
|
||||
daemon_reload: true
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
ansible.builtin.wait_for:
|
||||
timeout: "{{ postgres_start_wait_time }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
|
||||
- import_tasks: tasks/util/detect_existing_postgres_version.yml
|
||||
- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml
|
||||
|
||||
- name: Abort, if no existing Postgres version detected
|
||||
ansible.builtin.fail:
|
||||
msg: "Could not find existing Postgres installation"
|
||||
when: "not matrix_postgres_detected_existing|bool"
|
||||
when: "not matrix_postgres_detected_existing | bool"
|
||||
|
||||
# Starting the database container had automatically created the default
|
||||
# role (`matrix_postgres_connection_username`) and database (`matrix_postgres_db_name`).
|
||||
@@ -76,10 +76,10 @@
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
||||
--mount type=bind,src={{ server_path_postgres_dump }},dst=/{{ server_path_postgres_dump|basename }},ro
|
||||
--mount type=bind,src={{ server_path_postgres_dump }},dst=/{{ server_path_postgres_dump | basename }},ro
|
||||
--entrypoint=/bin/sh
|
||||
{{ matrix_postgres_docker_image_latest }}
|
||||
-c "cat /{{ server_path_postgres_dump|basename }} |
|
||||
-c "cat /{{ server_path_postgres_dump | basename }} |
|
||||
{{ 'gunzip |' if server_path_postgres_dump.endswith('.gz') else '' }}
|
||||
grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' |
|
||||
grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' |
|
||||
|
Reference in New Issue
Block a user