Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

85 linhas
3.2 KiB

  1. ---
  2. # (#1510)
  3. # - import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
  4. - name: Ensure hookshot image is pulled
  5. docker_image:
  6. name: "{{ matrix_hookshot_docker_image }}"
  7. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  8. force_source: "{{ matrix_hookshot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  9. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_hookshot_docker_image_force_pull }}"
  10. - name: Ensure hookshot paths exist
  11. file:
  12. path: "{{ item }}"
  13. state: directory
  14. mode: 0750
  15. owner: "{{ matrix_user_username }}"
  16. group: "{{ matrix_user_groupname }}"
  17. with_items:
  18. - "{{ matrix_hookshot_base_path }}"
  19. - name: Check if hookshot passkey exists
  20. stat:
  21. path: "{{ matrix_hookshot_base_path }}/passkey.pem"
  22. register: hookshot_passkey_file
  23. - name: Generate hookshot passkey if it doesn't exist
  24. shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096"
  25. become: true
  26. become_user: "{{ matrix_user_username }}"
  27. when: "not hookshot_passkey_file.stat.exists"
  28. - name: Ensure hookshot config.yaml installed if provided
  29. copy:
  30. content: "{{ matrix_hookshot_configuration|to_nice_yaml }}"
  31. dest: "{{ matrix_hookshot_base_path }}/config.yaml"
  32. mode: 0644
  33. owner: "{{ matrix_user_username }}"
  34. group: "{{ matrix_user_groupname }}"
  35. - name: Validate hookshot config.yml
  36. command: |
  37. {{ matrix_host_command_docker }} run
  38. --rm
  39. --name={{ matrix_hookshot_container_url }}-validate
  40. --user={{ matrix_user_uid }}:{{ matrix_user_gid }}
  41. --cap-drop=ALL
  42. -v {{ matrix_hookshot_base_path }}/config.yml:/config.yml
  43. {{ matrix_hookshot_docker_image }} node Config/Config.js /config.yml
  44. register: hookshot_config_validation_result
  45. - name: Fail if hookshot config.yml invalid
  46. fail:
  47. msg: "Your hookshot configuration did not pass validation:\n{{ hookshot_config_validation_result.stdout }}\n{{ hookshot_config_validation_result.stderr }}"
  48. when: "hookshot_config_validation_result.rc > 0"
  49. - name: Ensure hookshot registration.yaml installed if provided
  50. copy:
  51. content: "{{ matrix_hookshot_registration|to_nice_yaml }}"
  52. dest: "{{ matrix_hookshot_base_path }}/registration.yaml"
  53. mode: 0644
  54. owner: "{{ matrix_user_username }}"
  55. group: "{{ matrix_user_groupname }}"
  56. - name: Ensure hookshot github private key file installed if github is enabled
  57. copy:
  58. src: github-key.pem
  59. dest: "{{ matrix_hookshot_base_path }}/{{ matrix_hookshot_github_private_key }}"
  60. mode: 0600
  61. owner: "{{ matrix_user_username }}"
  62. group: "{{ matrix_user_groupname }}"
  63. - name: Ensure matrix-hookshot.service installed
  64. template:
  65. src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2"
  66. dest: "{{ matrix_systemd_path }}/matrix-hookshot.service"
  67. mode: 0644
  68. register: matrix_hookshot_systemd_service_result
  69. - name: Ensure systemd reloaded after matrix-hookshot.service installation
  70. service:
  71. daemon_reload: yes
  72. when: matrix_hookshot_systemd_service_result.changed