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

107 строки
4.8 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. community.docker.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: "{{ devture_playbook_help_container_retries_count }}"
  38. delay: "{{ devture_playbook_help_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. community.docker.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. - when: matrix_cactus_comments_client_local_dir | length == 0
  62. block:
  63. - name: Download web client js
  64. ansible.builtin.get_url:
  65. url: "{{ matrix_cactus_comments_webclient_js_url }}"
  66. dest: "{{ matrix_cactus_comments_client_path }}/cactus.js"
  67. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  68. owner: "{{ matrix_user_username }}"
  69. group: "{{ matrix_user_groupname }}"
  70. - name: Download web client css
  71. ansible.builtin.get_url:
  72. url: "{{ matrix_cactus_comments_webclient_css_url }}"
  73. dest: "{{ matrix_cactus_comments_client_path }}/style.css"
  74. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  75. owner: "{{ matrix_user_username }}"
  76. group: "{{ matrix_user_groupname }}"
  77. - when: matrix_cactus_comments_client_local_dir | length > 0
  78. block:
  79. - name: Propagate locally distributed client javascreipt
  80. ansible.builtin.copy:
  81. src: "{{ matrix_cactus_comments_client_local_dir }}/src/cactus.js"
  82. dest: "{{ matrix_cactus_comments_client_path }}/cactus.js"
  83. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  84. owner: "{{ matrix_user_username }}"
  85. group: "{{ matrix_user_groupname }}"
  86. - name: Propagate locally distributed client style.css
  87. ansible.builtin.copy:
  88. src: "{{ matrix_cactus_comments_client_local_dir }}/src/style.css"
  89. dest: "{{ matrix_cactus_comments_client_path }}/style.css"
  90. mode: "{{ matrix_cactus_comments_client_file_permissions }}"
  91. owner: "{{ matrix_user_username }}"
  92. group: "{{ matrix_user_groupname }}"
  93. - name: Ensure matrix-cactus-comments.service installed
  94. ansible.builtin.template:
  95. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2"
  96. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-cactus-comments.service"
  97. mode: 0644