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.
 
 

57 lines
1.8 KiB

  1. # SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Fail if playbook called incorrectly
  6. ansible.builtin.fail:
  7. msg: "The `one_time` variable needs to be provided to this playbook, via --extra-vars"
  8. when: "one_time is not defined or one_time not in ['yes', 'no']"
  9. - name: Fail if playbook called incorrectly
  10. ansible.builtin.fail:
  11. msg: "The `ex_date` variable (expiration date) needs to be provided to this playbook, via --extra-vars"
  12. when: "ex_date is not defined or ex_date == '<date>'"
  13. - name: Call matrix-registration token creation API
  14. ansible.builtin.uri:
  15. url: "{{ matrix_registration_api_token_endpoint }}"
  16. follow_redirects: none
  17. validate_certs: "{{ matrix_registration_api_validate_certs }}"
  18. headers:
  19. Content-Type: application/json
  20. Authorization: "SharedSecret {{ matrix_registration_admin_secret }}"
  21. method: POST
  22. body_format: json
  23. body: |
  24. {
  25. "one_time": {{ 'true' if one_time == 'yes' else 'false' }},
  26. "ex_date": {{ ex_date | to_json }}
  27. }
  28. check_mode: false
  29. register: matrix_registration_api_result
  30. - ansible.builtin.set_fact:
  31. matrix_registration_api_result_message: >-
  32. matrix-registration result:
  33. Direct registration link (with the token prefilled):
  34. {{ matrix_registration_api_register_endpoint }}?token={{ matrix_registration_api_result.json.name }}
  35. Full token details are:
  36. {{ matrix_registration_api_result.json }}
  37. check_mode: false
  38. - name: Inject result message into devture_playbook_runtime_messages_list
  39. ansible.builtin.set_fact:
  40. devture_playbook_runtime_messages_list: |
  41. {{
  42. devture_playbook_runtime_messages_list | default([])
  43. +
  44. [matrix_registration_api_result_message]
  45. }}
  46. check_mode: false