Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

53 righe
1.6 KiB

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