Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

103 rader
3.5 KiB

  1. ---
  2. #
  3. # Tasks related to setting up jitsi-jicofo
  4. #
  5. - name: Ensure Matrix jitsi-jicofo path exists
  6. file:
  7. path: "{{ item.path }}"
  8. state: directory
  9. mode: 0777
  10. owner: "{{ matrix_user_username }}"
  11. group: "{{ matrix_user_groupname }}"
  12. with_items:
  13. - {path: "{{ matrix_jitsi_jicofo_base_path }}", when: true}
  14. - {path: "{{ matrix_jitsi_jicofo_config_path }}", when: true}
  15. when: matrix_jitsi_enabled|bool and item.when
  16. - name: Ensure jitsi-jicofo Docker image is pulled
  17. docker_image:
  18. name: "{{ matrix_jitsi_jicofo_docker_image }}"
  19. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  20. force_source: "{{ matrix_jitsi_jicofo_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_jitsi_jicofo_docker_image_force_pull }}"
  22. when: matrix_jitsi_enabled|bool
  23. register: result
  24. retries: "{{ matrix_container_retries_count }}"
  25. delay: "{{ matrix_container_retries_delay }}"
  26. until: result is not failed
  27. - name: Ensure jitsi-jicofo environment variables file created
  28. template:
  29. src: "{{ role_path }}/templates/jicofo/env.j2"
  30. dest: "{{ matrix_jitsi_jicofo_base_path }}/env"
  31. owner: "{{ matrix_user_username }}"
  32. group: "{{ matrix_user_groupname }}"
  33. mode: 0640
  34. when: matrix_jitsi_enabled|bool
  35. - name: Ensure jitsi-jicofo configuration files created
  36. template:
  37. src: "{{ role_path }}/templates/jicofo/{{ item }}.j2"
  38. dest: "{{ matrix_jitsi_jicofo_config_path }}/{{ item }}"
  39. owner: "{{ matrix_user_username }}"
  40. group: "{{ matrix_user_groupname }}"
  41. mode: 0644
  42. with_items:
  43. - sip-communicator.properties
  44. - logging.properties
  45. when: matrix_jitsi_enabled|bool
  46. - name: Ensure matrix-jitsi-jicofo.service installed
  47. template:
  48. src: "{{ role_path }}/templates/jicofo/matrix-jitsi-jicofo.service.j2"
  49. dest: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
  50. mode: 0644
  51. register: matrix_jitsi_jicofo_systemd_service_result
  52. when: matrix_jitsi_enabled|bool
  53. - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service installation
  54. service:
  55. daemon_reload: true
  56. when: "matrix_jitsi_enabled and matrix_jitsi_jicofo_systemd_service_result.changed"
  57. #
  58. # Tasks related to getting rid of jitsi-jicofo (if it was previously enabled)
  59. #
  60. - name: Check existence of matrix-jitsi-jicofo service
  61. stat:
  62. path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
  63. register: matrix_jitsi_jicofo_service_stat
  64. when: "not matrix_jitsi_enabled|bool"
  65. - name: Ensure matrix-jitsi-jicofo is stopped
  66. service:
  67. name: matrix-jitsi-jicofo
  68. state: stopped
  69. enabled: false
  70. daemon_reload: true
  71. register: stopping_result
  72. when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists"
  73. - name: Ensure matrix-jitsi-jicofo.service doesn't exist
  74. file:
  75. path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
  76. state: absent
  77. when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists"
  78. - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service removal
  79. service:
  80. daemon_reload: true
  81. when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists"
  82. - name: Ensure Matrix jitsi-jicofo paths doesn't exist
  83. file:
  84. path: "{{ matrix_jitsi_jicofo_base_path }}"
  85. state: absent
  86. when: "not matrix_jitsi_enabled|bool"
  87. # Intentionally not removing the Docker image when uninstalling.
  88. # We can't be sure it had been pulled by us in the first place.