list_image_uuids.yml 962 B

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. # Calls Prism Central to obtain a list of images
  3. # Returns a list of dictionaries containing the name and uuid of the images
  4. # Example output:
  5. # [
  6. # {'name': 'imageA', 'uuid': '00056e15-0223-d74a-497a-ecf4bbd9b8f0'},
  7. # {'name': 'imageB', 'uuid': '00056e15-0223-d74a-497a-ecf4bbd9b8f1'}
  8. # ]
  9. - name: Get Images list
  10. uri:
  11. url: "{{ pc_api_url }}/images/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 image names/UUIDs
  25. set_fact:
  26. image_uuids: "{{ image_uuids | default([]) + [ {'name': item.spec.name, 'uuid': item.metadata.uuid } ] }}"
  27. with_items: "{{ json_images_result.json.entities }}"
  28. - name: Debug | Print image names/UUIDs
  29. debug:
  30. msg: "Image names/uuids are: {{ image_uuids }}"
  31. when: global_debug|bool