Matrix Docker Ansible eploy
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

86 satır
3.3 KiB

  1. ---
  2. # This will throw a Permission Denied error if already mounted using fuse
  3. - name: Check Dendrite media store path
  4. stat:
  5. path: "{{ matrix_dendrite_media_store_path }}"
  6. register: local_path_media_store_stat
  7. ignore_errors: yes
  8. # This is separate and conditional, to ensure we don't execute it
  9. # if the path already exists or we failed to check, because it's mounted using fuse.
  10. - name: Ensure Dendrite media store path exists
  11. file:
  12. path: "{{ matrix_dendrite_media_store_path }}"
  13. state: directory
  14. mode: 0750
  15. owner: "{{ matrix_user_username }}"
  16. group: "{{ matrix_user_groupname }}"
  17. when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists"
  18. - name: Ensure Dendrite log path exists
  19. file:
  20. path: "{{ matrix_dendrite_log_path }}"
  21. state: directory
  22. mode: 0644
  23. owner: "{{ matrix_user_username }}"
  24. group: "{{ matrix_user_groupname }}"
  25. - name: Ensure Dendrite Docker image is pulled
  26. docker_image:
  27. name: "{{ matrix_dendrite_docker_image }}"
  28. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  29. force_source: "{{ matrix_dendrite_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  30. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_dendrite_docker_image_force_pull }}"
  31. - name: Check if a Dendrite signing key exists
  32. stat:
  33. path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem"
  34. register: matrix_dendrite_signing_key_stat
  35. # We do this so that the signing key would get generated.
  36. # We don't use the `docker_container` module, because using it with `cap_drop` requires
  37. # a very recent version, which is not available for a lot of people yet.
  38. - name: Generate Dendrite signing key
  39. command: |
  40. docker run
  41. --rm
  42. --name=matrix-config
  43. --entrypoint=generate-keys
  44. --mount type=bind,src={{ matrix_dendrite_config_dir_path }},dst=/data
  45. {{ matrix_dendrite_docker_image }} --private-key=/data/{{ matrix_server_fqn_matrix }}.signing.pem
  46. generate
  47. when: "not matrix_dendrite_signing_key_stat.stat.exists"
  48. - name: Ensure Dendrite server key exists
  49. file:
  50. path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem"
  51. mode: 0644
  52. owner: "{{ matrix_user_username }}"
  53. group: "{{ matrix_user_groupname }}"
  54. - name: Ensure Dendrite configuration installed
  55. copy:
  56. content: "{{ matrix_dendrite_configuration|to_nice_yaml }}"
  57. dest: "{{ matrix_dendrite_config_dir_path }}/dendrite.yaml"
  58. mode: 0644
  59. owner: "{{ matrix_user_username }}"
  60. group: "{{ matrix_user_groupname }}"
  61. - name: Ensure matrix-dendrite.service installed
  62. template:
  63. src: "{{ role_path }}/templates/dendrite/systemd/matrix-dendrite.service.j2"
  64. dest: "{{ matrix_systemd_path }}/matrix-dendrite.service"
  65. mode: 0644
  66. register: matrix_dendrite_systemd_service_result
  67. - name: Ensure systemd reloaded after matrix-dendrite.service installation
  68. service:
  69. daemon_reload: yes
  70. when: "matrix_dendrite_systemd_service_result.changed"
  71. - name: Ensure matrix-dendrite-create-account script created
  72. template:
  73. src: "{{ role_path }}/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2"
  74. dest: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account"
  75. mode: 0750