Matrix Docker Ansible eploy
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

67 lignes
2.2 KiB

  1. - name: Fail if Postgres not enabled
  2. fail:
  3. msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate."
  4. when: "not matrix_postgres_enabled|bool"
  5. # Defaults
  6. - name: Set postgres_start_wait_time, if not provided
  7. set_fact:
  8. postgres_start_wait_time: 15
  9. when: "postgres_start_wait_time|default('') == ''"
  10. # Actual import work
  11. - name: Ensure matrix-postgres is started
  12. service:
  13. name: matrix-postgres
  14. state: started
  15. daemon_reload: yes
  16. register: matrix_postgres_service_start_result
  17. - name: Wait a bit, so that Postgres can start
  18. wait_for:
  19. timeout: "{{ postgres_start_wait_time }}"
  20. delegate_to: 127.0.0.1
  21. become: false
  22. when: "matrix_postgres_service_start_result.changed|bool"
  23. - name: Ensure matrix-appservice-slack is stopped
  24. service:
  25. name: matrix-appservice-slack
  26. state: stopped
  27. - name: Import appservice-slack NeDB database into Postgres
  28. command:
  29. cmd: >-
  30. {{ matrix_host_command_docker }} run
  31. --rm
  32. --user={{ matrix_user_uid }}:{{ matrix_user_gid }}
  33. --cap-drop=ALL
  34. --network={{ matrix_docker_network }}
  35. --mount type=bind,src={{ matrix_appservice_slack_data_path }},dst=/data
  36. --entrypoint=/bin/sh
  37. {{ matrix_appservice_slack_docker_image }}
  38. -c
  39. '/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}'
  40. - name: Archive NeDB database files
  41. command:
  42. cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup"
  43. with_items:
  44. - teams.db
  45. - room-store.db
  46. - user-store.db
  47. - event-store.db
  48. - name: Inject result
  49. set_fact:
  50. matrix_playbook_runtime_results: |
  51. {{
  52. matrix_playbook_runtime_results|default([])
  53. +
  54. [
  55. "NOTE: Your appservice-slack database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_slack_data_path }}/*.db` to `{{ matrix_appservice_slack_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files."
  56. ]
  57. }}