Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

80 wiersze
2.8 KiB

  1. ---
  2. - name: Fail if playbook called incorrectly
  3. fail: msg="The `local_path_homeserver_db` variable needs to be provided to this playbook, via --extra-vars"
  4. when: "local_path_homeserver_db is not defined or local_path_homeserver_db.startswith('<')"
  5. - name: Check if the provided SQLite homeserver.db file exists
  6. stat: path="{{ local_path_homeserver_db }}"
  7. delegate_to: 127.0.0.1
  8. become: false
  9. register: local_path_homeserver_db_stat
  10. - name: Fail if provided SQLite homeserver.db file doesn't exist
  11. fail: msg="File cannot be found on the local machine at {{ local_path_homeserver_db }}"
  12. when: not local_path_homeserver_db_stat.stat.exists
  13. - name: Ensure scratchpad directory exists
  14. file:
  15. path: "{{ matrix_scratchpad_dir }}"
  16. state: directory
  17. mode: 0755
  18. owner: "{{ matrix_user_username }}"
  19. group: "{{ matrix_user_username }}"
  20. - name: Ensure provided SQLite homeserver.db file is copied to scratchpad directory on the server
  21. synchronize:
  22. src: "{{ local_path_homeserver_db }}"
  23. dest: "{{ matrix_scratchpad_dir }}/homeserver.db"
  24. - name: Ensure matrix-postgres is stopped
  25. service: name=matrix-postgres state=stopped daemon_reload=yes
  26. - name: Ensure postgres data is wiped out
  27. file:
  28. path: "{{ matrix_postgres_data_path }}"
  29. state: absent
  30. - name: Ensure postgres data path exists
  31. file:
  32. path: "{{ matrix_postgres_data_path }}"
  33. state: directory
  34. mode: 0700
  35. owner: "{{ matrix_user_username }}"
  36. group: "{{ matrix_user_username }}"
  37. - name: Ensure matrix-postgres is started
  38. service: name=matrix-postgres state=restarted daemon_reload=yes
  39. - name: Wait a while, so that Postgres can manage to start
  40. pause: seconds=7
  41. # Fixes a problem with porting the `user_directory_search` table.
  42. # https://github.com/matrix-org/synapse/issues/2287
  43. - name: Ensure synapse_port_db_with_patch exists
  44. copy:
  45. src: "{{ role_path }}/files/synapse_port_db_with_patch"
  46. dest: "{{ matrix_scratchpad_dir }}/synapse_port_db_with_patch"
  47. - name: Importing SQLite database into Postgres
  48. docker_container:
  49. name: matrix-synapse-migrate
  50. image: "{{ docker_matrix_image }}"
  51. detach: no
  52. cleanup: yes
  53. entrypoint: /usr/bin/python
  54. command: "/usr/local/bin/synapse_port_db_with_patch --sqlite-database /scratchpad/homeserver.db --postgres-config /data/homeserver.yaml"
  55. user: "{{ matrix_user_uid }}:{{ matrix_user_gid }}"
  56. volumes:
  57. - "{{ matrix_synapse_config_dir_path }}:/data"
  58. - "{{ matrix_synapse_run_path }}:/matrix-run"
  59. - "{{ matrix_synapse_media_store_path }}:/matrix-media-store"
  60. - "{{ matrix_scratchpad_dir }}:/scratchpad"
  61. - "{{ matrix_scratchpad_dir }}/synapse_port_db_with_patch:/usr/local/bin/synapse_port_db_with_patch"
  62. links:
  63. - "matrix-postgres:postgres"
  64. - name: Ensure scratchpad directory is deleted
  65. file:
  66. path: "{{ matrix_scratchpad_dir }}"
  67. state: absent