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

78 строки
3.0 KiB

  1. ---
  2. - name: Ensure Cinny paths exists
  3. 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_client_cinny_data_path }}", when: true}
  11. - {path: "{{ matrix_client_cinny_docker_src_files_path }}", when: "{{ matrix_client_cinny_container_image_self_build }}"}
  12. when: "item.when|bool"
  13. - name: Ensure Cinny Docker image is pulled
  14. docker_image:
  15. name: "{{ matrix_client_cinny_docker_image }}"
  16. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  17. force_source: "{{ matrix_client_cinny_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  18. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_client_cinny_docker_image_force_pull }}"
  19. when: "not matrix_client_cinny_container_image_self_build|bool"
  20. register: result
  21. retries: "{{ matrix_container_retries_count }}"
  22. delay: "{{ matrix_container_retries_delay }}"
  23. until: result is not failed
  24. - name: Ensure Cinny repository is present on self-build
  25. git:
  26. repo: "{{ matrix_client_cinny_container_image_self_build_repo }}"
  27. dest: "{{ matrix_client_cinny_docker_src_files_path }}"
  28. version: "{{ matrix_client_cinny_docker_image.split(':')[1] }}"
  29. force: "yes"
  30. become: true
  31. become_user: "{{ matrix_user_username }}"
  32. register: matrix_client_cinny_git_pull_results
  33. when: "matrix_client_cinny_container_image_self_build|bool"
  34. - name: Ensure Cinny configuration installed
  35. copy:
  36. content: "{{ matrix_client_cinny_configuration|to_nice_json }}"
  37. dest: "{{ matrix_client_cinny_data_path }}/config.json"
  38. mode: 0644
  39. owner: "{{ matrix_user_username }}"
  40. group: "{{ matrix_user_groupname }}"
  41. - name: Ensure Cinny additional config files installed
  42. template:
  43. src: "{{ item.src }}"
  44. dest: "{{ matrix_client_cinny_data_path }}/{{ item.name }}"
  45. mode: 0644
  46. owner: "{{ matrix_user_username }}"
  47. group: "{{ matrix_user_groupname }}"
  48. with_items:
  49. - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
  50. when: "item.src is not none"
  51. - name: Ensure Cinny Docker image is built
  52. docker_image:
  53. name: "{{ matrix_client_cinny_docker_image }}"
  54. source: build
  55. force_source: "{{ matrix_client_cinny_git_pull_results.changed }}"
  56. build:
  57. dockerfile: Dockerfile
  58. path: "{{ matrix_client_cinny_docker_src_files_path }}"
  59. pull: true
  60. when: "matrix_client_cinny_container_image_self_build|bool"
  61. - name: Ensure matrix-client-cinny.service installed
  62. template:
  63. src: "{{ role_path }}/templates/systemd/matrix-client-cinny.service.j2"
  64. dest: "{{ matrix_systemd_path }}/matrix-client-cinny.service"
  65. mode: 0644
  66. register: matrix_client_cinny_systemd_service_result
  67. - name: Ensure systemd reloaded after matrix-client-cinny.service installation
  68. service:
  69. daemon_reload: true
  70. when: "matrix_client_cinny_systemd_service_result.changed|bool"