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

51 строка
1.6 KiB

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