|
|
@ -15,6 +15,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
- import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
|
|
|
- import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# These (SQLite -> Postgres) migration tasks are usually at the top,
|
|
|
|
|
|
|
|
# but we'd like to run them after `migrate_mxisd.yml`, which requires the ma1sd paths to exist.
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
|
|
|
matrix_ma1sd_requires_restart: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Check if an SQLite database already exists
|
|
|
|
|
|
|
|
stat:
|
|
|
|
|
|
|
|
path: "{{ matrix_ma1sd_sqlite_database_path_local }}"
|
|
|
|
|
|
|
|
register: matrix_ma1sd_sqlite_database_path_local_stat_result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
|
|
|
matrix_postgres_db_migration_request:
|
|
|
|
|
|
|
|
src: "{{ matrix_ma1sd_sqlite_database_path_local }}"
|
|
|
|
|
|
|
|
dst: "{{ matrix_ma1sd_database_connection_string }}"
|
|
|
|
|
|
|
|
caller: "{{ role_path|basename }}"
|
|
|
|
|
|
|
|
engine_variable_name: 'matrix_ma1sd_database_engine'
|
|
|
|
|
|
|
|
engine_old: 'sqlite'
|
|
|
|
|
|
|
|
systemd_services_to_stop: ['matrix-ma1sd.service']
|
|
|
|
|
|
|
|
pgloader_options: ['--with "quote identifiers"']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- import_tasks: "roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
|
|
|
matrix_ma1sd_requires_restart: true
|
|
|
|
|
|
|
|
when: "matrix_ma1sd_sqlite_database_path_local_stat_result.stat.exists|bool"
|
|
|
|
|
|
|
|
when: "matrix_ma1sd_database_engine == 'postgres'"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Ensure ma1sd image is pulled
|
|
|
|
- name: Ensure ma1sd image is pulled
|
|
|
|
docker_image:
|
|
|
|
docker_image:
|
|
|
|
name: "{{ matrix_ma1sd_docker_image }}"
|
|
|
|
name: "{{ matrix_ma1sd_docker_image }}"
|
|
|
@ -102,3 +132,9 @@
|
|
|
|
service:
|
|
|
|
service:
|
|
|
|
daemon_reload: yes
|
|
|
|
daemon_reload: yes
|
|
|
|
when: "matrix_ma1sd_systemd_service_result.changed|bool"
|
|
|
|
when: "matrix_ma1sd_systemd_service_result.changed|bool"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Ensure matrix-ma1sd.service restarted, if necessary
|
|
|
|
|
|
|
|
service:
|
|
|
|
|
|
|
|
name: "matrix-ma1sd.service"
|
|
|
|
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
when: "matrix_ma1sd_requires_restart|bool"
|
|
|
|