Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

64 line
3.1 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. community.docker.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: "{{ devture_playbook_help_container_retries_count }}"
  30. delay: "{{ devture_playbook_help_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. community.docker.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: "{{ devture_systemd_docker_base_systemd_path }}/matrix-bot-matrix-registration-bot.service"
  57. mode: 0644