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.
 
 

85 Zeilen
3.3 KiB

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