Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

65 Zeilen
2.9 KiB

  1. ---
  2. - name: Ensure matrix-registration-bot paths exist
  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_bot_matrix_registration_bot_config_path }}", when: true}
  11. - {path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}", when: true}
  12. when: "item.when|bool"
  13. - name: Ensure matrix-registration-bot image is pulled
  14. docker_image:
  15. name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
  16. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  17. force_source: "{{ matrix_bot_matrix_registration_bot_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_bot_matrix_registration_bot_docker_image_force_pull }}"
  19. when: "not matrix_bot_matrix_registration_bot_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 matrix-registration-bot repository is present on self-build
  25. git:
  26. repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}"
  27. dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  28. force: "yes"
  29. become: true
  30. become_user: "{{ matrix_user_username }}"
  31. register: matrix_bot_matrix_registration_bot_git_pull_results
  32. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  33. - name: Ensure matrix-registration-bot image is built
  34. docker_image:
  35. name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
  36. source: build
  37. force_source: "{{ matrix_bot_matrix_registration_bot_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  38. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
  39. build:
  40. dockerfile: Dockerfile
  41. path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  42. pull: true
  43. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  44. - name: Ensure matrix-bot-matrix-registration-bot.service installed
  45. template:
  46. src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2"
  47. dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
  48. mode: 0644
  49. register: matrix_bot_matrix_registration_bot_systemd_service_result
  50. - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation
  51. service:
  52. daemon_reload: true
  53. when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool"
  54. - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary
  55. service:
  56. name: "matrix-bot-matrix-registration-bot.service"
  57. state: restarted