Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

87 строки
2.8 KiB

  1. ---
  2. # This will throw a Permission Denied error if already mounted using fuse
  3. - name: Check Matrix Synapse media store path
  4. stat: path="{{ matrix_synapse_media_store_path }}"
  5. register: local_path_media_store_stat
  6. ignore_errors: yes
  7. # This is separate and conditional, to ensure we don't execute it
  8. # if the path already exists or we failed to check, because it's mounted using fuse.
  9. - name: Ensure Matrix media store path exists
  10. file:
  11. path: "{{ matrix_synapse_media_store_path }}"
  12. state: directory
  13. mode: 0750
  14. owner: "{{ matrix_user_username }}"
  15. group: "{{ matrix_user_username }}"
  16. when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists"
  17. - name: Ensure Matrix Docker image is pulled
  18. docker_image:
  19. name: "{{ matrix_synapse_docker_image }}"
  20. - name: Check if a Matrix Synapse configuration exists
  21. stat:
  22. path: "{{ matrix_synapse_config_dir_path }}/homeserver.yaml"
  23. register: matrix_synapse_config_stat
  24. # We do this mostly so that the keys would get generated.
  25. # We'll replace the rest of the configuration with our own templates below.
  26. - name: Generate initial Matrix config
  27. docker_container:
  28. name: matrix-config
  29. image: "{{ matrix_synapse_docker_image }}"
  30. detach: no
  31. cleanup: yes
  32. command: generate
  33. env:
  34. SYNAPSE_CONFIG_PATH: "/data/homeserver.yaml"
  35. SYNAPSE_SERVER_NAME: "{{ hostname_matrix }}"
  36. SYNAPSE_REPORT_STATS: "no"
  37. user: "{{ matrix_user_uid }}:{{ matrix_user_gid }}"
  38. volumes:
  39. - "{{ matrix_synapse_config_dir_path }}:/data"
  40. when: "not matrix_synapse_config_stat.stat.exists"
  41. - name: Ensure Matrix homeserver config installed
  42. template:
  43. src: "{{ matrix_synapse_template_synapse_homeserver }}"
  44. dest: "{{ matrix_synapse_config_dir_path }}/homeserver.yaml"
  45. mode: 0644
  46. - name: Ensure Matrix log config installed
  47. template:
  48. src: "{{ matrix_synapse_template_synapse_log }}"
  49. dest: "{{ matrix_synapse_config_dir_path }}/{{ hostname_matrix }}.log.config"
  50. mode: 0644
  51. - name: Ensure Synapse environment variables file created
  52. template:
  53. src: "{{ role_path }}/templates/env/env-synapse.j2"
  54. dest: "{{ matrix_environment_variables_data_path }}/synapse"
  55. owner: root
  56. mode: 0600
  57. - name: Ensure matrix-synapse.service installed
  58. template:
  59. src: "{{ role_path }}/templates/systemd/matrix-synapse.service.j2"
  60. dest: "/etc/systemd/system/matrix-synapse.service"
  61. mode: 0644
  62. - name: Ensure matrix-synapse-register-user script created
  63. template:
  64. src: "{{ role_path }}/templates/usr-local-bin/matrix-synapse-register-user.j2"
  65. dest: "/usr/local/bin/matrix-synapse-register-user"
  66. mode: 0750
  67. - name: Allow access to Matrix ports in firewalld
  68. firewalld:
  69. port: "{{ item }}"
  70. state: enabled
  71. immediate: yes
  72. permanent: yes
  73. with_items:
  74. - '8448/tcp' # Matrix federation
  75. when: ansible_os_family == 'RedHat'