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

64 строки
2.6 KiB

  1. ---
  2. - name: Ensure matrix-registration 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_registration_base_path }}", when: true }
  11. - { path: "{{ matrix_registration_config_path }}", when: true }
  12. - { path: "{{ matrix_registration_data_path }}", when: true }
  13. - { path: "{{ matrix_registration_docker_src_files_path }}", when: "{{ matrix_registration_container_image_self_build }}"}
  14. when: "item.when|bool"
  15. - name: Ensure matrix-registration image is pulled
  16. docker_image:
  17. name: "{{ matrix_registration_docker_image }}"
  18. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  19. force_source: "{{ matrix_registration_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_registration_docker_image_force_pull }}"
  21. when: "not matrix_registration_container_image_self_build|bool"
  22. - name: Ensure matrix-registration repository is present when self-building
  23. git:
  24. repo: "{{ matrix_registration_container_image_self_build_repo }}"
  25. dest: "{{ matrix_registration_docker_src_files_path }}"
  26. version: "{{ matrix_registration_container_image_self_build_branch }}"
  27. force: "yes"
  28. register: matrix_registration_git_pull_results
  29. when: "matrix_registration_container_image_self_build|bool"
  30. - name: Ensure matrix-registration Docker image is built
  31. docker_image:
  32. name: "{{ matrix_registration_docker_image }}"
  33. source: build
  34. force_source: "{{ matrix_registration_git_pull_results.changed }}"
  35. build:
  36. dockerfile: Dockerfile
  37. path: "{{ matrix_registration_docker_src_files_path }}"
  38. pull: yes
  39. when: "matrix_registration_container_image_self_build|bool"
  40. - name: Ensure matrix-registration config installed
  41. copy:
  42. content: "{{ matrix_registration_configuration|to_nice_yaml }}"
  43. dest: "{{ matrix_registration_config_path }}/config.yaml"
  44. mode: 0644
  45. owner: "{{ matrix_user_username }}"
  46. group: "{{ matrix_user_groupname }}"
  47. - name: Ensure matrix-registration.service installed
  48. template:
  49. src: "{{ role_path }}/templates/systemd/matrix-registration.service.j2"
  50. dest: "{{ matrix_systemd_path }}/matrix-registration.service"
  51. mode: 0644
  52. register: matrix_registration_systemd_service_result
  53. - name: Ensure systemd reloaded after matrix-registration.service installation
  54. service:
  55. daemon_reload: yes
  56. when: "matrix_registration_systemd_service_result.changed|bool"