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.
 
 

80 line
3.4 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-amp role needs to execute before the matrix-synapse role.
  8. when: "matrix_synapse_role_executed|default(False)"
  9. - name: Ensure Mautrix Amp image is pulled
  10. docker_image:
  11. name: "{{ matrix_mautrix_amp_docker_image }}"
  12. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  13. force_source: "{{ matrix_mautrix_amp_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  14. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_amp_docker_image_force_pull }}"
  15. when: matrix_mautrix_amp_enabled|bool
  16. - name: Ensure Mautrix Amp Puppeteer image is pulled
  17. docker_image:
  18. name: "{{ matrix_mautrix_amp_puppeteer_docker_image }}"
  19. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  20. force_source: "{{ matrix_mautrix_amp_puppeteer_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  21. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_amp_puppeteer_docker_image_force_pull }}"
  22. when: matrix_mautrix_amp_enabled|bool
  23. - name: Ensure Mautrix Amp paths exist
  24. file:
  25. path: "{{ item }}"
  26. state: directory
  27. mode: 0750
  28. owner: "{{ matrix_user_username }}"
  29. group: "{{ matrix_user_groupname }}"
  30. with_items:
  31. - "{{ matrix_mautrix_amp_base_path }}"
  32. - "{{ matrix_mautrix_amp_config_path }}"
  33. - "{{ matrix_mautrix_amp_puppeteer_path }}"
  34. - name: Ensure mautrix-amp-puppeteer config.json installed
  35. copy:
  36. content: "{{ matrix_mautrix_amp_puppeteer_config|to_nice_json }}"
  37. dest: "{{ matrix_mautrix_amp_puppeteer_path }}/config.json"
  38. mode: 0644
  39. owner: "{{ matrix_user_username }}"
  40. group: "{{ matrix_user_groupname }}"
  41. - name: Ensure mautrix-amp config.yaml installed
  42. copy:
  43. content: "{{ matrix_mautrix_amp_configuration|to_nice_yaml }}"
  44. dest: "{{ matrix_mautrix_amp_config_path }}/config.yaml"
  45. mode: 0644
  46. owner: "{{ matrix_user_username }}"
  47. group: "{{ matrix_user_groupname }}"
  48. - name: Ensure mautrix-amp registration.yaml installed
  49. copy:
  50. content: "{{ matrix_mautrix_amp_registration|to_nice_yaml }}"
  51. dest: "{{ matrix_mautrix_amp_config_path }}/registration.yaml"
  52. mode: 0644
  53. owner: "{{ matrix_user_username }}"
  54. group: "{{ matrix_user_groupname }}"
  55. - name: Ensure matrix-mautrix-amp-puppeteer.service installed
  56. template:
  57. src: "{{ role_path }}/templates/systemd/matrix-mautrix-amp-puppeteer.service.j2"
  58. dest: "{{ matrix_systemd_path }}/matrix-mautrix-amp-puppeteer.service"
  59. mode: 0644
  60. register: matrix_mautrix_amp_puppeteer_systemd_service_result
  61. - name: Ensure matrix-mautrix-amp.service installed
  62. template:
  63. src: "{{ role_path }}/templates/systemd/matrix-mautrix-amp.service.j2"
  64. dest: "{{ matrix_systemd_path }}/matrix-mautrix-amp.service"
  65. mode: 0644
  66. register: matrix_mautrix_amp_systemd_service_result
  67. - name: Ensure systemd reloaded after matrix-mautrix-amp.service installation
  68. service:
  69. daemon_reload: yes
  70. when: "matrix_mautrix_amp_systemd_service_result.changed or matrix_mautrix_amp_puppeteer_systemd_service_result.changed"