Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

75 wiersze
3.5 KiB

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