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

70 строки
3.1 KiB

  1. ---
  2. - set_fact:
  3. matrix_bot_matrix_registration_bot_requires_restart: false
  4. - name: Ensure matrix-registration-bot paths exist
  5. file:
  6. path: "{{ item.path }}"
  7. state: directory
  8. mode: 0750
  9. owner: "{{ matrix_user_username }}"
  10. group: "{{ matrix_user_groupname }}"
  11. with_items:
  12. - {path: "{{ matrix_bot_matrix_registration_bot_config_path }}", when: true}
  13. - {path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}", when: true}
  14. when: "item.when|bool"
  15. - name: Ensure matrix-registration-bot image is pulled
  16. docker_image:
  17. name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
  18. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  19. force_source: "{{ matrix_bot_matrix_registration_bot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  20. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_matrix_registration_bot_docker_image_force_pull }}"
  21. when: "not matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  22. register: result
  23. retries: "{{ matrix_container_retries_count }}"
  24. delay: "{{ matrix_container_retries_delay }}"
  25. until: result is not failed
  26. - name: Ensure matrix-registration-bot repository is present on self-build
  27. git:
  28. repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}"
  29. dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  30. force: "yes"
  31. become: true
  32. become_user: "{{ matrix_user_username }}"
  33. register: matrix_bot_matrix_registration_bot_git_pull_results
  34. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  35. - name: Ensure matrix-registration-bot image is built
  36. docker_image:
  37. name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
  38. source: build
  39. force_source: "{{ matrix_bot_matrix_registration_bot_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  40. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
  41. build:
  42. dockerfile: docker/Dockerfile
  43. path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  44. pull: true
  45. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  46. - name: Ensure matrix-bot-matrix-registration-bot.service installed
  47. template:
  48. src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2"
  49. dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
  50. mode: 0644
  51. register: matrix_bot_matrix_registration_bot_systemd_service_result
  52. - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation
  53. service:
  54. daemon_reload: true
  55. when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool"
  56. - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary
  57. service:
  58. name: "matrix-bot-matrix-registration-bot.service"
  59. state: restarted
  60. when: "matrix_bot_matrix_registration_bot_requires_restart|bool"