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.
 
 

84 regels
2.5 KiB

  1. ---
  2. #
  3. # Tasks related to setting up the dimension
  4. #
  5. - name: Ensure Dimension base path exists
  6. file:
  7. path: "{{ matrix_dimension_base_path }}"
  8. state: directory
  9. mode: 0770
  10. owner: "{{ matrix_user_username }}"
  11. group: "{{ matrix_dimension_user_gid }}"
  12. when: matrix_dimension_enabled|bool
  13. - name: Ensure Dimension config installed
  14. copy:
  15. content: "{{ matrix_dimension_configuration|to_nice_yaml }}"
  16. dest: "{{ matrix_dimension_base_path }}/config.yaml"
  17. mode: 0640
  18. owner: "{{ matrix_user_username }}"
  19. group: "{{ matrix_dimension_user_gid }}"
  20. when: matrix_dimension_enabled|bool
  21. - name: Ensure Dimension image is pulled
  22. docker_image:
  23. name: "{{ matrix_dimension_docker_image }}"
  24. source: "pull"
  25. when: matrix_dimension_enabled|bool
  26. - name: Ensure matrix-dimension.service installed
  27. template:
  28. src: "{{ role_path }}/templates/systemd/matrix-dimension.service.j2"
  29. dest: "/etc/systemd/system/matrix-dimension.service"
  30. mode: 0644
  31. register: matrix_dimension_systemd_service_result
  32. when: matrix_dimension_enabled|bool
  33. - name: Ensure systemd reloaded after matrix-dimension.service installation
  34. service:
  35. daemon_reload: yes
  36. when: "matrix_dimension_enabled|bool and matrix_dimension_systemd_service_result.changed"
  37. #
  38. # Tasks related to getting rid of the dimension (if it was previously enabled)
  39. #
  40. - name: Check existence of matrix-dimension service
  41. stat:
  42. path: "/etc/systemd/system/matrix-dimension.service"
  43. register: matrix_dimension_service_stat
  44. when: "not matrix_dimension_enabled|bool"
  45. - name: Ensure matrix-dimension is stopped
  46. service:
  47. name: matrix-dimension
  48. state: stopped
  49. daemon_reload: yes
  50. register: stopping_result
  51. when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
  52. - name: Ensure matrix-dimension.service doesn't exist
  53. file:
  54. path: "/etc/systemd/system/matrix-dimension.service"
  55. state: absent
  56. when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
  57. - name: Ensure systemd reloaded after matrix-dimension.service removal
  58. service:
  59. daemon_reload: yes
  60. when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
  61. - name: Ensure Dimension environment variables path doesn't exist
  62. file:
  63. path: "{{ matrix_dimension_base_path }}"
  64. state: absent
  65. when: "not matrix_dimension_enabled|bool"
  66. - name: Ensure Dimension Docker image doesn't exist
  67. docker_image:
  68. name: "{{ matrix_dimension_docker_image }}"
  69. state: absent
  70. when: "not matrix_dimension_enabled|bool"