Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

72 rader
2.8 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. - name: Ensure Cinny repository is present on self-build
  21. git:
  22. repo: "{{ matrix_client_cinny_container_image_self_build_repo }}"
  23. dest: "{{ matrix_client_cinny_docker_src_files_path }}"
  24. version: "{{ matrix_client_cinny_docker_image.split(':')[1] }}"
  25. force: "yes"
  26. register: matrix_client_cinny_git_pull_results
  27. when: "matrix_client_cinny_container_image_self_build|bool"
  28. - name: Ensure Cinny configuration installed
  29. copy:
  30. content: "{{ matrix_client_cinny_configuration|to_nice_json }}"
  31. dest: "{{ matrix_client_cinny_data_path }}/config.json"
  32. mode: 0644
  33. owner: "{{ matrix_user_username }}"
  34. group: "{{ matrix_user_groupname }}"
  35. - name: Ensure Cinny additional config files installed
  36. template:
  37. src: "{{ item.src }}"
  38. dest: "{{ matrix_client_cinny_data_path }}/{{ item.name }}"
  39. mode: 0644
  40. owner: "{{ matrix_user_username }}"
  41. group: "{{ matrix_user_groupname }}"
  42. with_items:
  43. - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
  44. when: "item.src is not none"
  45. - name: Ensure Cinny Docker image is built
  46. docker_image:
  47. name: "{{ matrix_client_cinny_docker_image }}"
  48. source: build
  49. force_source: "{{ matrix_client_cinny_git_pull_results.changed }}"
  50. build:
  51. dockerfile: Dockerfile
  52. path: "{{ matrix_client_cinny_docker_src_files_path }}"
  53. pull: yes
  54. when: "matrix_client_cinny_container_image_self_build|bool"
  55. - name: Ensure matrix-client-cinny.service installed
  56. template:
  57. src: "{{ role_path }}/templates/systemd/matrix-client-cinny.service.j2"
  58. dest: "{{ matrix_systemd_path }}/matrix-client-cinny.service"
  59. mode: 0644
  60. register: matrix_client_cinny_systemd_service_result
  61. - name: Ensure systemd reloaded after matrix-client-cinny.service installation
  62. service:
  63. daemon_reload: yes
  64. when: "matrix_client_cinny_systemd_service_result.changed|bool"