Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

74 líneas
3.3 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_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. 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. git:
  34. repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}"
  35. dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  36. force: "yes"
  37. become: true
  38. become_user: "{{ matrix_user_username }}"
  39. register: matrix_bot_matrix_registration_bot_git_pull_results
  40. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  41. - name: Ensure matrix-registration-bot image is built
  42. docker_image:
  43. name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
  44. source: build
  45. force_source: "{{ matrix_bot_matrix_registration_bot_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  46. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
  47. build:
  48. dockerfile: Dockerfile
  49. path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
  50. pull: true
  51. when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
  52. - name: Ensure matrix-bot-matrix-registration-bot.service installed
  53. template:
  54. src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2"
  55. dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
  56. mode: 0644
  57. register: matrix_bot_matrix_registration_bot_systemd_service_result
  58. - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation
  59. service:
  60. daemon_reload: true
  61. when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool"
  62. - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary
  63. service:
  64. name: "matrix-bot-matrix-registration-bot.service"
  65. state: restarted