Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

117 wiersze
3.8 KiB

  1. ---
  2. #
  3. # Tasks related to setting up mxisd
  4. #
  5. - name: (Deprecation) Warn about mxisd variables that are not used anymore
  6. fail:
  7. msg: >
  8. The `{{ item }}` variable defined in your configuration is not used by this playbook anymore!
  9. You'll need to adapt to the new way of extending mxisd configuration.
  10. See the CHANGELOG and the `matrix_mxisd_configuration_extension_yaml` variable for more information and examples.
  11. when: "matrix_mxisd_enabled and item in vars"
  12. with_items:
  13. - 'matrix_mxisd_ldap_enabled'
  14. - 'matrix_mxisd_ldap_connection_host'
  15. - 'matrix_mxisd_ldap_connection_tls'
  16. - 'matrix_mxisd_ldap_connection_port'
  17. - 'matrix_mxisd_ldap_connection_baseDn'
  18. - 'matrix_mxisd_ldap_connection_baseDns'
  19. - 'matrix_mxisd_ldap_connection_bindDn'
  20. - 'matrix_mxisd_ldap_connection_bindPassword'
  21. - 'matrix_mxisd_ldap_filter'
  22. - 'matrix_mxisd_ldap_attribute_uid_type'
  23. - 'matrix_mxisd_ldap_attribute_uid_value'
  24. - 'matrix_mxisd_ldap_connection_bindPassword'
  25. - 'matrix_mxisd_ldap_attribute_name'
  26. - 'matrix_mxisd_ldap_attribute_threepid_email'
  27. - 'matrix_mxisd_ldap_attribute_threepid_msisdn'
  28. - 'matrix_mxisd_ldap_identity_filter'
  29. - 'matrix_mxisd_ldap_identity_medium'
  30. - 'matrix_mxisd_ldap_auth_filter'
  31. - 'matrix_mxisd_ldap_directory_filter'
  32. - 'matrix_mxisd_template_config'
  33. - name: Ensure mxisd configuration does not contain any dot-notation keys
  34. fail:
  35. msg: >
  36. Since version 1.3.0, mxisd will not accept property-style configuration keys.
  37. You have defined a key (`{{ item.key }}`) which contains a dot.
  38. Instead, use nesting. See: https://github.com/kamax-matrix/mxisd/wiki/Upgrade#v130
  39. when: "matrix_mxisd_enabled and '.' in item.key"
  40. with_dict: "{{ matrix_mxisd_configuration }}"
  41. - name: Fail if mailer is not enabled
  42. fail:
  43. msg: "You need to enable the mailer service (`matrix_mailer_enabled`) to install mxisd"
  44. when: "matrix_mxisd_enabled and not matrix_mailer_enabled"
  45. - name: Ensure mxisd paths exist
  46. file:
  47. path: "{{ item }}"
  48. state: directory
  49. mode: 0750
  50. owner: "{{ matrix_user_username }}"
  51. group: "{{ matrix_user_username }}"
  52. with_items:
  53. - "{{ matrix_mxisd_config_path }}"
  54. - "{{ matrix_mxisd_data_path }}"
  55. when: matrix_mxisd_enabled
  56. - name: Ensure mxisd image is pulled
  57. docker_image:
  58. name: "{{ matrix_mxisd_docker_image }}"
  59. when: matrix_mxisd_enabled
  60. - name: Ensure mxisd config installed
  61. copy:
  62. content: "{{ matrix_mxisd_configuration|to_nice_yaml }}"
  63. dest: "{{ matrix_mxisd_config_path }}/mxisd.yaml"
  64. mode: 0644
  65. owner: "{{ matrix_user_username }}"
  66. group: "{{ matrix_user_username }}"
  67. when: matrix_mxisd_enabled
  68. - name: Ensure matrix-mxisd.service installed
  69. template:
  70. src: "{{ role_path }}/templates/systemd/matrix-mxisd.service.j2"
  71. dest: "/etc/systemd/system/matrix-mxisd.service"
  72. mode: 0644
  73. when: matrix_mxisd_enabled
  74. #
  75. # Tasks related to getting rid of mxisd (if it was previously enabled)
  76. #
  77. - name: Check existence of matrix-mxisd service
  78. stat:
  79. path: "/etc/systemd/system/matrix-mxisd.service"
  80. register: matrix_mxisd_service_stat
  81. - name: Ensure matrix-mxisd is stopped
  82. service:
  83. name: matrix-mxisd
  84. state: stopped
  85. daemon_reload: yes
  86. register: stopping_result
  87. when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
  88. - name: Ensure matrix-mxisd.service doesn't exist
  89. file:
  90. path: "/etc/systemd/system/matrix-mxisd.service"
  91. state: absent
  92. when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
  93. - name: Ensure Matrix mxisd paths don't exist
  94. file:
  95. path: "{{ matrix_mxisd_base_path }}"
  96. state: absent
  97. when: "not matrix_mxisd_enabled"
  98. - name: Ensure mxisd Docker image doesn't exist
  99. docker_image:
  100. name: "{{ matrix_mxisd_docker_image }}"
  101. state: absent
  102. when: "not matrix_mxisd_enabled"