123456789101112131415161718192021222324252627282930313233343536 |
- ---
- # Calls Prism Central to obtain a list of clusters
- # Returns a list of dictionaries containing the name and uuid of the clusters
- # Example output:
- # [
- # {'name': 'ntx-web', 'uuid': '00053e3-0255-d94a-457a-ecf4bdfgfb8g0'},
- # {'name': 'ntx-app', 'uuid': '00522e15-0234-d94a-457a-ecf4bbdfb8g1'}
- # ]
-
- - name: Get clusters list
- uri:
- url: "{{ pc_api_url }}/clusters/list"
- body:
- kind: cluster
- sort_order: ASCENDING
- offset: 0
- length: 10
- sort_attribute: ''
- method: POST
- validate_certs: no
- body_format: json
- status_code: 200
- headers:
- Cookie: "{{ pc_session_cookie }}"
- register: json_clusters_result
- ignore_errors: yes
- - name: Store the cluster names/UUIDs
- set_fact:
- cluster_uuids: "{{ cluster_uuids|default([]) + [ {'name': item.spec.name, 'uuid': item.metadata.uuid } ] }}"
- with_items: "{{ json_clusters_result.json.entities }}"
- - name: Debug | Print cluster name/UUIDs
- debug:
- msg: "Cluster names/uuids : {{ cluster_uuids }}"
- when: global_debug|bool
|