trying to use the rest_info module to input into other tasks to rename things such as nodes and LIFs.
- name: Get info from cluster na_ontap_rest_info: use_rest: always gather_subset: - cluster/nodes fields: - 'name' <<: *login register: ontap_info - debug: msg: "{{ ontap_info.ontap_info}}"
- name: Rename Nodes na_ontap_node: use_rest: always from_name: "{{ ontap_info.ontap_info.records.name }}" name: "{{ node1name }}" <<: *login
This prints the nodename and other things, i cant seem to figure out how to narrow the output down to just the 'name'. when specifying fields it still shows uuid and other items in structure.
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Node not found: {'cluster/nodes': {'records': [{'uuid': '76ca839a-bc22-11ed-a1c9-000c29957a37', 'name': 'cluster0300-01', '_links': {'self': {'href': '/api/cluster/nodes/76ca839a-bc22-11ed-a1c9-000c29957a37'}}}], 'num_records': 1, '_links': {'self': {'href': '/api/cluster/nodes?max_records=1024&fields=name'}}}}"}
I realise this is not a netapp ansible problem, but if anyone can help my format the json output that would be awsome.