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.
 
 

78 satır
3.1 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 Docker image is pulled
  19. docker_image:
  20. name: "{{ matrix_dendrite_docker_image }}"
  21. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  22. force_source: "{{ matrix_dendrite_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  23. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_dendrite_docker_image_force_pull }}"
  24. - name: Check if a Dendrite signing key exists
  25. stat:
  26. path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem"
  27. register: matrix_dendrite_signing_key_stat
  28. # We do this so that the signing key would get generated.
  29. # We don't use the `docker_container` module, because using it with `cap_drop` requires
  30. # a very recent version, which is not available for a lot of people yet.
  31. - name: Generate Dendrite signing key
  32. command: |
  33. docker run
  34. --rm
  35. --name=matrix-dendrite-config
  36. --entrypoint=generate-keys
  37. --mount type=bind,src={{ matrix_dendrite_config_dir_path }},dst=/data
  38. {{ matrix_dendrite_docker_image }} --private-key=/data/{{ matrix_server_fqn_matrix }}.signing.pem
  39. generate
  40. when: "not matrix_dendrite_signing_key_stat.stat.exists"
  41. - name: Ensure Dendrite server key exists
  42. file:
  43. path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem"
  44. mode: 0644
  45. owner: "{{ matrix_user_username }}"
  46. group: "{{ matrix_user_groupname }}"
  47. - name: Ensure Dendrite configuration installed
  48. copy:
  49. content: "{{ matrix_dendrite_configuration|to_nice_yaml }}"
  50. dest: "{{ matrix_dendrite_config_dir_path }}/dendrite.yaml"
  51. mode: 0644
  52. owner: "{{ matrix_user_username }}"
  53. group: "{{ matrix_user_groupname }}"
  54. - name: Ensure matrix-dendrite.service installed
  55. template:
  56. src: "{{ role_path }}/templates/dendrite/systemd/matrix-dendrite.service.j2"
  57. dest: "{{ matrix_systemd_path }}/matrix-dendrite.service"
  58. mode: 0644
  59. register: matrix_dendrite_systemd_service_result
  60. - name: Ensure systemd reloaded after matrix-dendrite.service installation
  61. service:
  62. daemon_reload: yes
  63. when: "matrix_dendrite_systemd_service_result.changed|bool"
  64. - name: Ensure matrix-dendrite-create-account script created
  65. template:
  66. src: "{{ role_path }}/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2"
  67. dest: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account"
  68. mode: 0750