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

76 строки
2.9 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. register: matrix_client_cinny_git_pull_results
  31. when: "matrix_client_cinny_container_image_self_build|bool"
  32. - name: Ensure Cinny configuration installed
  33. copy:
  34. content: "{{ matrix_client_cinny_configuration|to_nice_json }}"
  35. dest: "{{ matrix_client_cinny_data_path }}/config.json"
  36. mode: 0644
  37. owner: "{{ matrix_user_username }}"
  38. group: "{{ matrix_user_groupname }}"
  39. - name: Ensure Cinny additional config files installed
  40. template:
  41. src: "{{ item.src }}"
  42. dest: "{{ matrix_client_cinny_data_path }}/{{ item.name }}"
  43. mode: 0644
  44. owner: "{{ matrix_user_username }}"
  45. group: "{{ matrix_user_groupname }}"
  46. with_items:
  47. - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
  48. when: "item.src is not none"
  49. - name: Ensure Cinny Docker image is built
  50. docker_image:
  51. name: "{{ matrix_client_cinny_docker_image }}"
  52. source: build
  53. force_source: "{{ matrix_client_cinny_git_pull_results.changed }}"
  54. build:
  55. dockerfile: Dockerfile
  56. path: "{{ matrix_client_cinny_docker_src_files_path }}"
  57. pull: true
  58. when: "matrix_client_cinny_container_image_self_build|bool"
  59. - name: Ensure matrix-client-cinny.service installed
  60. template:
  61. src: "{{ role_path }}/templates/systemd/matrix-client-cinny.service.j2"
  62. dest: "{{ matrix_systemd_path }}/matrix-client-cinny.service"
  63. mode: 0644
  64. register: matrix_client_cinny_systemd_service_result
  65. - name: Ensure systemd reloaded after matrix-client-cinny.service installation
  66. service:
  67. daemon_reload: true
  68. when: "matrix_client_cinny_systemd_service_result.changed|bool"