Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

96 строки
4.0 KiB

  1. ---
  2. - name: Ensure cactus comments paths exist
  3. ansible.builtin.file:
  4. path: "{{ item.path }}"
  5. state: directory
  6. mode: 0750
  7. owner: "{{ matrix_user_username }}"
  8. group: "{{ matrix_user_groupname }}"
  9. with_items:
  10. - {path: "{{ matrix_cactus_comments_base_path }}", when: true}
  11. - {path: "{{ matrix_cactus_comments_client_path }}", when: true}
  12. - {path: "{{ matrix_cactus_comments_container_tmp_path }}", when: true}
  13. - {path: "{{ matrix_cactus_comments_docker_src_files_path }}", when: matrix_cactus_comments_container_image_self_build}
  14. when: "item.when | bool"
  15. - name: Ensure cactus comments environment file created
  16. ansible.builtin.template:
  17. src: "{{ role_path }}/templates/env.j2"
  18. dest: "{{ matrix_cactus_comments_app_service_env_file }}"
  19. owner: "{{ matrix_user_username }}"
  20. group: "{{ matrix_user_groupname }}"
  21. mode: 0640
  22. - name: Ensure cactus comments appservice file created
  23. ansible.builtin.template:
  24. src: "{{ role_path }}/templates/cactus_appservice.yaml.j2"
  25. dest: "{{ matrix_cactus_comments_app_service_config_file }}"
  26. owner: "{{ matrix_user_username }}"
  27. group: "{{ matrix_user_groupname }}"
  28. mode: 0640
  29. - name: Ensure cactus comments image is pulled
  30. docker_image:
  31. name: "{{ matrix_cactus_comments_docker_image }}"
  32. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  33. force_source: "{{ matrix_cactus_comments_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  34. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_docker_image_force_pull }}"
  35. when: "not matrix_cactus_comments_container_image_self_build | bool"
  36. register: result
  37. retries: "{{ matrix_container_retries_count }}"
  38. delay: "{{ matrix_container_retries_delay }}"
  39. until: result is not failed
  40. - name: Ensure cactus comments repository is present on self-build
  41. ansible.builtin.git:
  42. repo: "{{ matrix_cactus_comments_docker_repo }}"
  43. version: "{{ matrix_cactus_comments_docker_repo_version }}"
  44. dest: "{{ matrix_cactus_comments_docker_src_files_path }}"
  45. force: "yes"
  46. become: true
  47. become_user: "{{ matrix_user_username }}"
  48. register: matrix_cactus_comments_git_pull_results
  49. when: "matrix_cactus_comments_container_image_self_build | bool"
  50. - name: Ensure cactus comments image is built
  51. docker_image:
  52. name: "{{ matrix_cactus_comments_docker_image }}"
  53. source: build
  54. force_source: "{{ matrix_cactus_comments_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  55. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
  56. build:
  57. dockerfile: Dockerfile
  58. path: "{{ matrix_cactus_comments_docker_src_files_path }}"
  59. pull: true
  60. when: "matrix_cactus_comments_container_image_self_build | bool"
  61. - name: Ensure client javascript file is downloaded
  62. ansible.builtin.get_url:
  63. url: https://latest.cactus.chat/cactus.js
  64. dest: "{{ matrix_cactus_comments_client_path }}/cactus.js"
  65. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  66. - name: Ensure client css file is downloaded
  67. ansible.builtin.get_url:
  68. url: https://latest.cactus.chat/style.css
  69. dest: "{{ matrix_cactus_comments_client_path }}/style.css"
  70. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  71. - name: Ensure matrix-cactus-comments.service installed
  72. ansible.builtin.template:
  73. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2"
  74. dest: "{{ matrix_systemd_path }}/matrix-cactus-comments.service"
  75. mode: 0644
  76. register: matrix_cactus_comments_systemd_service_result
  77. - name: Ensure systemd reloaded after matrix-cactus-comments.service installation
  78. ansible.builtin.service:
  79. daemon_reload: true
  80. when: "matrix_cactus_comments_systemd_service_result.changed | bool"
  81. - name: Ensure matrix-cactus-comments.service restarted, if necessary
  82. ansible.builtin.service:
  83. name: "matrix-cactus-comments.service"
  84. state: restarted