mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-10-19 22:53:23 +00:00
Fix no-changed-when ansible-lint errors
Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#no-changed-when
This commit is contained in:
@@ -78,18 +78,21 @@
|
||||
# role (`matrix_postgres_connection_username`) and database (`matrix_postgres_db_name`) by itself on startup,
|
||||
# we need to remove these from the dump, or we'll get errors saying these already exist.
|
||||
- name: Perform Postgres database dump
|
||||
ansible.builtin.command: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-postgres-dump
|
||||
--log-driver=none
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--network={{ matrix_docker_network }}
|
||||
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
||||
--entrypoint=/bin/sh
|
||||
--mount type=bind,src={{ postgres_dump_dir }},dst=/out
|
||||
{{ matrix_postgres_detected_version_corresponding_docker_image }}
|
||||
-c "pg_dumpall -h matrix-postgres
|
||||
{{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }}
|
||||
> /out/{{ postgres_dump_name }}"
|
||||
ansible.builtin.command:
|
||||
cmd: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-postgres-dump
|
||||
--log-driver=none
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--network={{ matrix_docker_network }}
|
||||
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
||||
--entrypoint=/bin/sh
|
||||
--mount type=bind,src={{ postgres_dump_dir }},dst=/out
|
||||
{{ matrix_postgres_detected_version_corresponding_docker_image }}
|
||||
-c "pg_dumpall -h matrix-postgres
|
||||
{{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }}
|
||||
> /out/{{ postgres_dump_name }}"
|
||||
register: matrix_postgres_upgrade_postgres_dump_command_result
|
||||
changed_when: matrix_postgres_upgrade_postgres_dump_command_result.rc == 0
|
||||
|
||||
- name: Ensure matrix-postgres is stopped
|
||||
ansible.builtin.service:
|
||||
@@ -97,7 +100,10 @@
|
||||
state: stopped
|
||||
|
||||
- name: Rename existing Postgres data directory
|
||||
ansible.builtin.command: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}"
|
||||
register: matrix_postgres_upgrade_postgres_move_command_result
|
||||
changed_when: matrix_postgres_upgrade_postgres_move_command_result.rc == 0
|
||||
|
||||
- ansible.builtin.debug:
|
||||
msg: "NOTE: Your Postgres data directory has been moved from `{{ matrix_postgres_data_path }}` to `{{ postgres_auto_upgrade_backup_data_path }}`. In the event of failure, you can move it back and run the playbook with --tags=setup-postgres to restore operation."
|
||||
@@ -155,7 +161,10 @@
|
||||
and restore the automatically-made backup (`mv {{ postgres_auto_upgrade_backup_data_path }} {{ matrix_postgres_data_path }}`).
|
||||
|
||||
- name: Perform Postgres database import
|
||||
ansible.builtin.command: "{{ matrix_postgres_import_command }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ matrix_postgres_import_command }}"
|
||||
register: matrix_postgres_upgrade_postgres_import_command_result
|
||||
changed_when: matrix_postgres_upgrade_postgres_import_command_result.rc == 0
|
||||
|
||||
- name: Delete Postgres database dump file
|
||||
ansible.builtin.file:
|
||||
|
Reference in New Issue
Block a user