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

111 строки
5.0 KiB

  1. ---
  2. - name: Ensure matrix-appservice-polychat 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_appservice_polychat_base_path }}", when: true}
  11. - {path: "{{ matrix_appservice_polychat_config_path }}", when: true}
  12. - {path: "{{ matrix_appservice_polychat_data_path }}", when: true}
  13. - {path: "{{ matrix_appservice_polychat_docker_src_files_path }}", when: "{{ matrix_appservice_polychat_container_image_self_build }}"}
  14. when: "item.when | bool"
  15. - name: Log into private registry and force re-authorization
  16. docker_login:
  17. registry: "{{ matrix_appservice_polychat_docker_login_registry }}"
  18. username: "{{ matrix_appservice_polychat_docker_login_username }}"
  19. password: "{{ matrix_appservice_polychat_docker_login_password }}"
  20. reauthorize: yes
  21. - name: Ensure matrix-appservice-polychat container image is pulled
  22. community.docker.docker_image:
  23. name: "{{ matrix_appservice_polychat_docker_image }}"
  24. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  25. force_source: "{{ matrix_appservice_polychat_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  26. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_polychat_docker_image_force_pull }}"
  27. when: "not matrix_appservice_polychat_container_image_self_build | bool"
  28. register: result
  29. retries: "{{ devture_playbook_help_container_retries_count }}"
  30. delay: "{{ devture_playbook_help_container_retries_delay }}"
  31. until: result is not failed
  32. - when: "matrix_appservice_polychat_container_image_self_build | bool"
  33. block:
  34. - name: Ensure matrix-appservice-polychat repository is present on self-build
  35. ansible.builtin.git:
  36. repo: "{{ matrix_appservice_polychat_container_image_self_build_repo }}"
  37. dest: "{{ matrix_appservice_polychat_docker_src_files_path }}"
  38. version: "{{ matrix_appservice_polychat_container_image_self_build_repo_version }}"
  39. force: "yes"
  40. become: true
  41. become_user: "{{ matrix_user_username }}"
  42. register: matrix_appservice_polychat_git_pull_results
  43. - name: Ensure matrix-appservice-polychat container image is built
  44. community.docker.docker_image:
  45. name: "{{ matrix_appservice_polychat_docker_image }}"
  46. source: build
  47. force_source: "{{ matrix_appservice_polychat_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  48. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_polychat_git_pull_results.changed }}"
  49. build:
  50. dockerfile: "{{ matrix_appservice_polychat_container_image_self_build_repo_dockerfile_path }}"
  51. path: "{{ matrix_appservice_polychat_docker_src_files_path }}"
  52. pull: true
  53. - name: Ensure matrix-appservice-polychat config is installed
  54. ansible.builtin.copy:
  55. content: "{{ matrix_appservice_polychat_configuration | to_nice_yaml(indent=2, width=999999) }}"
  56. dest: "{{ matrix_appservice_polychat_config_path }}/config.yaml"
  57. mode: 0644
  58. owner: "{{ matrix_user_username }}"
  59. group: "{{ matrix_user_groupname }}"
  60. - name: Ensure matrix-appservice-polychat schema.yml template exists
  61. ansible.builtin.template:
  62. src: "{{ role_path }}/templates/schema.yml.j2"
  63. dest: "{{ matrix_appservice_polychat_config_path }}/schema.yml"
  64. mode: 0644
  65. owner: "{{ matrix_user_username }}"
  66. group: "{{ matrix_user_groupname }}"
  67. - name: Ensure matrix-appservice-polychat database.json template exists
  68. ansible.builtin.template:
  69. src: "{{ role_path }}/templates/database.json.j2"
  70. dest: "{{ matrix_appservice_polychat_data_path }}/database.json"
  71. mode: 0644
  72. owner: "{{ matrix_user_username }}"
  73. group: "{{ matrix_user_groupname }}"
  74. - name: Ensure appservice-polychat registration.yaml installed
  75. ansible.builtin.copy:
  76. content: "{{ matrix_appservice_polychat_registration | to_nice_yaml(indent=2, width=999999) }}"
  77. dest: "{{ matrix_appservice_polychat_config_path }}/registration.yaml"
  78. mode: 0644
  79. owner: "{{ matrix_user_username }}"
  80. group: "{{ matrix_user_groupname }}"
  81. - name: Ensure matrix-appservice-polychat container network is created
  82. community.general.docker_network:
  83. name: "{{ matrix_appservice_polychat_container_network }}"
  84. driver: bridge
  85. - name: Ensure matrix-appservice-polychat support files installed
  86. ansible.builtin.template:
  87. src: "{{ role_path }}/templates/{{ item }}.j2"
  88. dest: "{{ matrix_appservice_polychat_base_path }}/{{ item }}"
  89. mode: 0640
  90. owner: "{{ matrix_user_username }}"
  91. group: "{{ matrix_user_groupname }}"
  92. with_items:
  93. - labels
  94. - name: Ensure matrix-appservice-polychat.service installed
  95. ansible.builtin.template:
  96. src: "{{ role_path }}/templates/systemd/matrix-appservice-polychat.service.j2"
  97. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-polychat.service"
  98. mode: 0644