@ -3,38 +3,48 @@
|
||||
# Pre-checks
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
fail: msg="The `server_path_media_store` variable needs to be provided to this playbook, via --extra-vars"
|
||||
fail:
|
||||
msg: "The `server_path_media_store` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "server_path_media_store is not defined or server_path_media_store.startswith('<')"
|
||||
|
||||
- name: Fail if media store is on Amazon S3
|
||||
fail: msg="Your media store is on Amazon S3. Due to technical limitations, restoring is not supported."
|
||||
fail:
|
||||
msg: "Your media store is on Amazon S3. Due to technical limitations, restoring is not supported."
|
||||
when: "matrix_s3_media_store_enabled"
|
||||
|
||||
- name: Check if the provided media store directory exists
|
||||
stat: path="{{ server_path_media_store }}"
|
||||
stat:
|
||||
path: "{{ server_path_media_store }}"
|
||||
register: server_path_media_store_stat
|
||||
|
||||
- name: Fail if provided media store directory doesn't exist on the server
|
||||
fail: msg="{{ server_path_media_store }} cannot be found on the server"
|
||||
fail:
|
||||
msg: "{{ server_path_media_store }} cannot be found on the server"
|
||||
when: "not server_path_media_store_stat.stat.exists or not server_path_media_store_stat.stat.isdir"
|
||||
|
||||
- name: Check if media store contains local_content
|
||||
stat: path="{{ server_path_media_store }}/local_content"
|
||||
stat:
|
||||
path: "{{ server_path_media_store }}/local_content"
|
||||
register: server_path_media_store_local_content_stat
|
||||
|
||||
- name: Check if media store contains remote_content
|
||||
stat: path="{{ server_path_media_store }}/remote_content"
|
||||
stat:
|
||||
path: "{{ server_path_media_store }}/remote_content"
|
||||
register: server_path_media_store_remote_content_stat
|
||||
|
||||
- name: Fail if media store directory doesn't look okay (lacking remote and local content)
|
||||
fail: msg="{{ server_path_media_store }} contains neither local_content nor remote_content directories. It's most likely a mistake and is not a media store directory."
|
||||
fail:
|
||||
msg: "{{ server_path_media_store }} contains neither local_content nor remote_content directories. It's most likely a mistake and is not a media store directory."
|
||||
when: "not server_path_media_store_local_content_stat.stat.exists and not server_path_media_store_remote_content_stat.stat.exists"
|
||||
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-synapse is stopped
|
||||
service: name=matrix-synapse state=stopped daemon_reload=yes
|
||||
service:
|
||||
name: matrix-synapse
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
|
||||
# This can only work with local files, not if the media store is on Amazon S3,
|
||||
@ -64,7 +74,10 @@
|
||||
# all files become owned by whoever needs to own them.
|
||||
|
||||
- name: Ensure Matrix Synapse is started (if it previously was)
|
||||
service: name="{{ item }}" state=started daemon_reload=yes
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
when: stopping_result.changed
|
||||
with_items:
|
||||
- matrix-synapse
|
||||
|
@ -3,21 +3,25 @@
|
||||
# Pre-checks
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
fail: msg="The `server_path_postgres_dump` variable needs to be provided to this playbook, via --extra-vars"
|
||||
fail:
|
||||
msg: "The `server_path_postgres_dump` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "server_path_postgres_dump is not defined or server_path_postgres_dump.startswith('<')"
|
||||
|
||||
- name: Check if the provided Postgres dump file exists
|
||||
stat: path="{{ server_path_postgres_dump }}"
|
||||
stat:
|
||||
path: "{{ server_path_postgres_dump }}"
|
||||
register: result_server_path_postgres_dump_stat
|
||||
|
||||
- name: Fail if provided Postgres dump file doesn't exists
|
||||
fail: msg="File cannot be found on the server at {{ server_path_postgres_dump }}"
|
||||
fail:
|
||||
msg: "File cannot be found on the server at {{ server_path_postgres_dump }}"
|
||||
when: not result_server_path_postgres_dump_stat.stat.exists
|
||||
|
||||
- import_tasks: tasks/util/detect_existing_postgres_version.yml
|
||||
|
||||
- name: Abort, if no existing Postgres version detected
|
||||
fail: msg="Could not find existing Postgres installation"
|
||||
fail:
|
||||
msg: "Could not find existing Postgres installation"
|
||||
when: "not matrix_postgres_detected_existing"
|
||||
|
||||
|
||||
@ -32,7 +36,10 @@
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service: name=matrix-postgres state=started daemon_reload=yes
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
|
@ -3,15 +3,18 @@
|
||||
# Pre-checks
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
fail: msg="The `server_path_homeserver_db` variable needs to be provided to this playbook, via --extra-vars"
|
||||
fail:
|
||||
msg: "The `server_path_homeserver_db` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "server_path_homeserver_db is not defined or server_path_homeserver_db.startswith('<')"
|
||||
|
||||
- name: Check if the provided SQLite homeserver.db file exists
|
||||
stat: path="{{ server_path_homeserver_db }}"
|
||||
stat:
|
||||
path: "{{ server_path_homeserver_db }}"
|
||||
register: result_server_path_homeserver_db_stat
|
||||
|
||||
- name: Fail if provided SQLite homeserver.db file doesn't exist
|
||||
fail: msg="File cannot be found on the server at {{ server_path_homeserver_db }}"
|
||||
fail:
|
||||
msg: "File cannot be found on the server at {{ server_path_homeserver_db }}"
|
||||
when: not result_server_path_homeserver_db_stat.stat.exists
|
||||
|
||||
|
||||
@ -26,7 +29,10 @@
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is stopped
|
||||
service: name=matrix-postgres state=stopped daemon_reload=yes
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Ensure postgres data is wiped out
|
||||
file:
|
||||
@ -42,7 +48,10 @@
|
||||
group: "{{ matrix_user_username }}"
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service: name=matrix-postgres state=restarted daemon_reload=yes
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: restarted
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
|
Reference in New Issue
Block a user