Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

79 lines
2.9 KiB

  1. ---
  2. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
  3. # We don't want to fail in such cases.
  4. - name: Fail if matrix-synapse role already executed
  5. fail:
  6. msg: >-
  7. The matrix-bridge-mautrix-wsproxy role needs to execute before the matrix-synapse role.
  8. when: "matrix_synapse_role_executed|default(False)"
  9. - set_fact:
  10. matrix_mautrix_wsproxy_requires_restart: false
  11. - name: Ensure Mautrix wsproxy image is pulled
  12. docker_image:
  13. name: "{{ matrix_mautrix_wsproxy_docker_image }}"
  14. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  15. force_source: "{{ matrix_mautrix_wsproxy_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  16. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_wsproxy_docker_image_force_pull }}"
  17. - name: Ensure Mautrix wsproxy paths exists
  18. file:
  19. path: "{{ item }}"
  20. state: directory
  21. mode: 0750
  22. owner: "{{ matrix_user_username }}"
  23. group: "{{ matrix_user_groupname }}"
  24. with_items:
  25. - "{{ matrix_mautrix_wsproxy_base_path }}"
  26. - "{{ matrix_mautrix_wsproxy_config_path }}"
  27. - "{{ matrix_mautrix_wsproxy_data_path }}"
  28. - name: Check if an old matrix state file exists
  29. stat:
  30. path: "{{ matrix_mautrix_wsproxy_base_path }}/mx-state.json"
  31. register: matrix_mautrix_wsproxy_stat_mx_state
  32. - name: Ensure mautrix-wsproxy config.yaml installed
  33. copy:
  34. content: "{{ matrix_mautrix_wsproxy_configuration|to_nice_yaml }}"
  35. dest: "{{ matrix_mautrix_wsproxy_config_path }}/config.yaml"
  36. mode: 0644
  37. owner: "{{ matrix_user_username }}"
  38. group: "{{ matrix_user_groupname }}"
  39. - name: Ensure mautrix-imessage config-ios.yaml installed
  40. copy:
  41. content: "{{ matrix_mautrix_imessage_configuration|to_nice_yaml }}"
  42. dest: "{{ matrix_mautrix_wsproxy_config_path }}/config-ios.yaml"
  43. mode: 0644
  44. owner: "{{ matrix_user_username }}"
  45. group: "{{ matrix_user_groupname }}"
  46. - name: Ensure mautrix-wsproxy registration.yaml installed
  47. copy:
  48. content: "{{ matrix_mautrix_wsproxy_registration|to_nice_yaml }}"
  49. dest: "{{ matrix_mautrix_wsproxy_config_path }}/registration.yaml"
  50. mode: 0644
  51. owner: "{{ matrix_user_username }}"
  52. group: "{{ matrix_user_groupname }}"
  53. - name: Ensure matrix-mautrix-wsproxy.service installed
  54. template:
  55. src: "{{ role_path }}/templates/systemd/matrix-mautrix-wsproxy.service.j2"
  56. dest: "{{ matrix_systemd_path }}/matrix-mautrix-wsproxy.service"
  57. mode: 0644
  58. register: matrix_mautrix_wsproxy_systemd_service_result
  59. - name: Ensure systemd reloaded after matrix-mautrix-wsproxy.service installation
  60. service:
  61. daemon_reload: yes
  62. when: "matrix_mautrix_wsproxy_systemd_service_result.changed"
  63. - name: Ensure matrix-mautrix-wsproxy.service restarted, if necessary
  64. service:
  65. name: "matrix-mautrix-wsproxy.service"
  66. state: restarted
  67. when: "matrix_mautrix_wsproxy_requires_restart|bool"