list_subnet_uuids.yml 981 B

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. # Calls Prism Central to obtain a list of networks/subnets
  3. # Returns a list of dictionaries containing the name and uuid of the subnets
  4. # Example output:
  5. # [
  6. # {'name': 'subnetA', 'uuid': '00056e15-0223-d74a-497a-ecf4bbd9b8f0'},
  7. # {'name': 'subnetB', 'uuid': '00056e15-0223-d74a-497a-ecf4bbd9b8f1'}
  8. # ]
  9. - name: Get Subnet List
  10. uri:
  11. url: "{{ pc_api_url }}/subnets/list"
  12. body:
  13. length: 100
  14. offset: 0
  15. filter: ""
  16. method: POST
  17. validate_certs: no
  18. body_format: json
  19. status_code: 200
  20. headers:
  21. Cookie: "{{ pc_session_cookie }}"
  22. register: json_images_result
  23. ignore_errors: yes
  24. - name: Store the subnet names/UUIDs
  25. set_fact:
  26. subnet_uuids: "{{ subnet_uuids|default([]) + [ {'name': item.spec.name, 'uuid': item.metadata.uuid } ] }}"
  27. with_items: "{{ json_images_result.json.entities }}"
  28. - name: Debug | Print Subnet names/UUIDs
  29. debug:
  30. msg: "Subnet names/uuids are: {{ subnet_uuids }}"
  31. when: global_debug|bool