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

112 строки
5.7 KiB

  1. ---
  2. - name: Ensure matrix-appservice-kakaotalk image is pulled
  3. community.docker.docker_image:
  4. name: "{{ matrix_appservice_kakaotalk_docker_image }}"
  5. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  6. force_source: "{{ matrix_appservice_kakaotalk_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  7. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_kakaotalk_docker_image_force_pull }}"
  8. when: not matrix_appservice_kakaotalk_container_image_self_build
  9. register: result
  10. retries: "{{ devture_playbook_help_container_retries_count }}"
  11. delay: "{{ devture_playbook_help_container_retries_delay }}"
  12. until: result is not failed
  13. - name: Ensure matrix-appservice-kakaotalk-node image is pulled
  14. community.docker.docker_image:
  15. name: "{{ matrix_appservice_kakaotalk_node_docker_image }}"
  16. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  17. force_source: "{{ matrix_appservice_kakaotalk_node_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_appservice_kakaotalk_node_docker_image_force_pull }}"
  19. when: not matrix_appservice_kakaotalk_container_image_self_build
  20. register: result
  21. retries: "{{ devture_playbook_help_container_retries_count }}"
  22. delay: "{{ devture_playbook_help_container_retries_delay }}"
  23. until: result is not failed
  24. - name: Ensure matrix-appservice-kakaotalk paths exist
  25. ansible.builtin.file:
  26. path: "{{ item.path }}"
  27. state: directory
  28. mode: 0750
  29. owner: "{{ matrix_user_username }}"
  30. group: "{{ matrix_user_groupname }}"
  31. with_items:
  32. - {path: "{{ matrix_appservice_kakaotalk_base_path }}", when: true}
  33. - {path: "{{ matrix_appservice_kakaotalk_config_path }}", when: true}
  34. - {path: "{{ matrix_appservice_kakaotalk_data_path }}", when: true}
  35. - {path: "{{ matrix_appservice_kakaotalk_docker_src_files_path }}", when: "{{ matrix_appservice_kakaotalk_container_image_self_build }}"}
  36. when: item.when | bool
  37. - name: Ensure matrix-appservice-kakaotalk repository is present on self-build
  38. ansible.builtin.git:
  39. repo: "{{ matrix_appservice_kakaotalk_container_image_self_build_repo }}"
  40. dest: "{{ matrix_appservice_kakaotalk_docker_src_files_path }}"
  41. version: "{{ matrix_appservice_kakaotalk_container_image_self_build_repo_version }}"
  42. force: "yes"
  43. become: true
  44. become_user: "{{ matrix_user_username }}"
  45. register: matrix_appservice_kakaotalk_git_pull_results
  46. when: "matrix_appservice_kakaotalk_container_image_self_build | bool"
  47. - name: Ensure matrix-appservice-kakaotalk-node Docker image is built
  48. community.docker.docker_image:
  49. name: "{{ matrix_appservice_kakaotalk_node_docker_image }}"
  50. source: build
  51. force_source: "{{ matrix_appservice_kakaotalk_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  52. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_kakaotalk_git_pull_results.changed }}"
  53. build:
  54. dockerfile: Dockerfile
  55. path: "{{ matrix_appservice_kakaotalk_docker_src_files_path }}/node"
  56. pull: true
  57. when: "matrix_appservice_kakaotalk_container_image_self_build | bool"
  58. - name: Ensure matrix-appservice-kakaotalk Docker image is built
  59. community.docker.docker_image:
  60. name: "{{ matrix_appservice_kakaotalk_docker_image }}"
  61. source: build
  62. force_source: "{{ matrix_appservice_kakaotalk_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  63. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_kakaotalk_git_pull_results.changed }}"
  64. build:
  65. dockerfile: Dockerfile
  66. path: "{{ matrix_appservice_kakaotalk_docker_src_files_path }}"
  67. pull: true
  68. when: "matrix_appservice_kakaotalk_container_image_self_build | bool"
  69. - name: Ensure matrix-appservice-kakaotalk-node config.json installed
  70. ansible.builtin.copy:
  71. content: "{{ matrix_appservice_kakaotalk_node_configuration | to_nice_json }}"
  72. dest: "{{ matrix_appservice_kakaotalk_config_path }}/node-config.json"
  73. mode: 0644
  74. owner: "{{ matrix_user_username }}"
  75. group: "{{ matrix_user_groupname }}"
  76. - name: Ensure matrix-appservice-kakaotalk config.yaml installed
  77. ansible.builtin.copy:
  78. content: "{{ matrix_appservice_kakaotalk_configuration | to_nice_yaml(indent=2, width=999999) }}"
  79. dest: "{{ matrix_appservice_kakaotalk_config_path }}/config.yaml"
  80. mode: 0644
  81. owner: "{{ matrix_user_username }}"
  82. group: "{{ matrix_user_groupname }}"
  83. - name: Ensure matrix-appservice-kakaotalk registration.yaml installed
  84. ansible.builtin.copy:
  85. content: "{{ matrix_appservice_kakaotalk_registration | to_nice_yaml(indent=2, width=999999) }}"
  86. dest: "{{ matrix_appservice_kakaotalk_config_path }}/registration.yaml"
  87. mode: 0644
  88. owner: "{{ matrix_user_username }}"
  89. group: "{{ matrix_user_groupname }}"
  90. - name: Ensure matrix-appservice-kakaotalk-node.service installed
  91. ansible.builtin.template:
  92. src: "{{ role_path }}/templates/systemd/matrix-appservice-kakaotalk-node.service.j2"
  93. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-kakaotalk-node.service"
  94. mode: 0644
  95. register: matrix_appservice_kakaotalk_node_systemd_service_result
  96. - name: Ensure matrix-appservice-kakaotalk.service installed
  97. ansible.builtin.template:
  98. src: "{{ role_path }}/templates/systemd/matrix-appservice-kakaotalk.service.j2"
  99. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-kakaotalk.service"
  100. mode: 0644