Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

100 linhas
4.3 KiB

  1. # SPDX-FileCopyrightText: 2024 David Mehren
  2. # SPDX-FileCopyrightText: 2024 Slavi Pantaleev
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure matrix-cactus-comments-client paths exist
  7. ansible.builtin.file:
  8. path: "{{ item.path }}"
  9. state: directory
  10. mode: '0750'
  11. owner: "{{ matrix_user_name }}"
  12. group: "{{ matrix_group_name }}"
  13. with_items:
  14. - {path: "{{ matrix_cactus_comments_client_base_path }}", when: true}
  15. - {path: "{{ matrix_cactus_comments_client_public_path }}", when: true}
  16. when: "item.when | bool"
  17. - name: Ensure matrix-cactus-comments-client is configured
  18. ansible.builtin.template:
  19. src: "{{ item.src }}"
  20. dest: "{{ item.dest }}"
  21. owner: "{{ matrix_user_name }}"
  22. group: "{{ matrix_group_name }}"
  23. mode: '0644'
  24. with_items:
  25. - src: "{{ role_path }}/templates/env.j2"
  26. dest: "{{ matrix_cactus_comments_client_base_path }}/env"
  27. - src: "{{ role_path }}/templates/labels.j2"
  28. dest: "{{ matrix_cactus_comments_client_base_path }}/labels"
  29. register: matrix_cactus_comments_client_support_files_result
  30. - when: matrix_cactus_comments_client_local_dir | length == 0
  31. block:
  32. - name: Download web client js
  33. ansible.builtin.get_url:
  34. url: "{{ matrix_cactus_comments_client_webclient_js_url }}"
  35. dest: "{{ matrix_cactus_comments_client_public_path }}/cactus.js"
  36. mode: "{{ matrix_cactus_comments_client_public_path_file_permissions }}"
  37. owner: "{{ matrix_user_name }}"
  38. group: "{{ matrix_group_name }}"
  39. - name: Download web client css
  40. ansible.builtin.get_url:
  41. url: "{{ matrix_cactus_comments_client_webclient_css_url }}"
  42. dest: "{{ matrix_cactus_comments_client_public_path }}/style.css"
  43. mode: "{{ matrix_cactus_comments_client_public_path_file_permissions }}"
  44. owner: "{{ matrix_user_name }}"
  45. group: "{{ matrix_group_name }}"
  46. - when: matrix_cactus_comments_client_local_dir | length > 0
  47. block:
  48. - name: Upload locally distributed client JS
  49. ansible.builtin.copy:
  50. src: "{{ matrix_cactus_comments_client_local_dir }}/src/cactus.js"
  51. dest: "{{ matrix_cactus_comments_client_public_path }}/cactus.js"
  52. mode: "{{ matrix_cactus_comments_client_public_path_file_permissions }}"
  53. owner: "{{ matrix_user_name }}"
  54. group: "{{ matrix_group_name }}"
  55. - name: Upload locally distributed client CSS
  56. ansible.builtin.copy:
  57. src: "{{ matrix_cactus_comments_client_local_dir }}/src/style.css"
  58. dest: "{{ matrix_cactus_comments_client_public_path }}/style.css"
  59. mode: "{{ matrix_cactus_comments_client_public_path_file_permissions }}"
  60. owner: "{{ matrix_user_name }}"
  61. group: "{{ matrix_group_name }}"
  62. - name: Ensure matrix-cactus-comments-client container image is pulled
  63. community.docker.docker_image_pull:
  64. name: "{{ matrix_cactus_comments_client_container_image }}"
  65. pull: always
  66. register: matrix_cactus_comments_client_container_image_pull_result
  67. retries: "{{ devture_playbook_help_container_retries_count }}"
  68. delay: "{{ devture_playbook_help_container_retries_delay }}"
  69. until: matrix_cactus_comments_client_container_image_pull_result is not failed
  70. - name: Ensure matrix-cactus-comments-client container network is created
  71. community.general.docker_network:
  72. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  73. name: "{{ matrix_cactus_comments_client_container_network }}"
  74. driver: bridge
  75. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  76. - name: Ensure matrix-cactus-comments-client.service installed
  77. ansible.builtin.template:
  78. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments-client.service.j2"
  79. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-cactus-comments-client.service"
  80. mode: '0644'
  81. register: matrix_cactus_comments_client_systemd_service_result
  82. - name: Determine whether matrix-cactus-comments-client needs a restart
  83. ansible.builtin.set_fact:
  84. matrix_cactus_comments_client_restart_necessary: >-
  85. {{
  86. matrix_cactus_comments_client_support_files_result.changed | default(false)
  87. or matrix_cactus_comments_client_systemd_service_result.changed | default(false)
  88. or matrix_cactus_comments_client_container_image_pull_result.changed | default(false)
  89. }}