Yes, I got it what I was looking for. Thank you very much for your help *Todd* and *Walter*.
On Mon, 6 Mar 2023, 18:25 'Rowe, Walter P. (Fed)' via Ansible Project, < [email protected]> wrote: > Your 'aggregates' is a list of lists. For each aggregate list item, you > have a two-element list where element [0] is cluster name and element [1] > is aggregate name. > > Loop through aggregates, and use item.0 for cluster and item.1 for > hostname ? > > - name: Get info > na_ontap_rest_info: > <<: *login > gather_subset: > - storage/volumes > parameters: > aggregates.name > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Faggregates.name%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8ufA%2FwkmWiC3nxg1BzqEHFbaiEIgeJsE9ZDnbuhO%2BUQ%3D&reserved=0>: > "{{ item.1 }}" > hostname: "{{ item.0 }}" > use_python_keys: true > register: vol_data > loop: "{{ aggregates }}" > loop_control: > label: "{{ ?? }}" > no_log: false > - debug: var=vol_data > > Walter > -- > Walter Rowe, Division Chief > Infrastructure Services, OISM > Mobile: 202.355.4123 > > On Mar 4, 2023, at 7:27 AM, Aharonu <[email protected]> wrote: > > Hi Team, > > Greetings for the day! > > I have a variables called 'aggregates' under *vars* which ontaints > cluster1,cluster3,cluster2..etc and aggr1,aggr2,aggr3..etc list as > mentioned below. > > { > "aggregates": [ > [ > "Cluster1", > "aggr1" > ], > [ > "Cluster1", > "aggr2" > ], > [ > "Cluster1", > "aggr4" > ], > [ > "Cluster2", > "aggr1" > ], > [ > "Cluster3", > "aggr2" > ] > ] > } > > ******************************************************************** > Based on data from 'aggregates', Below playbook has 2 items to work on: > aggregates.name > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Faggregates.name%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8ufA%2FwkmWiC3nxg1BzqEHFbaiEIgeJsE9ZDnbuhO%2BUQ%3D&reserved=0> > : here we need to use aggr1,aggr3,aggr2...from variable 'aggregates' > hostname: here we need to use Cluster1,Cluster2,Cluster3...from variable ' > aggregates' > > What looking for is: > *it has to go through loop iteration until 'aggregates' list completed.* > First loop iteration has to go for Cluster1, aggr1, Second loop iteration > to go for Cluster1, aggr2 based on data from 'aggregates'. > > 1st loop iteration: > aggregates.name > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Faggregates.name%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8ufA%2FwkmWiC3nxg1BzqEHFbaiEIgeJsE9ZDnbuhO%2BUQ%3D&reserved=0>: > 'aggr1' > hostname: 'Cluster1' > 2nd loop iteration: > aggregates.name > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Faggregates.name%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8ufA%2FwkmWiC3nxg1BzqEHFbaiEIgeJsE9ZDnbuhO%2BUQ%3D&reserved=0>: > 'aggr2' > hostname: "Cluster1}" > > > Playbook: > --- > - hosts: localhost > gather_facts: false > collections: > - netapp.ontap > vars_files: > - < login file path > > vars: > aggregates: [] > login: &login > username: "{{ username }}" > password: "{{ password }}" > https: true > validate_certs: false > feature_flags: > trace_apis: true > tasks: > - name: Get info > na_ontap_rest_info: > <<: *login > gather_subset: > - storage/volumes > parameters: > aggregates.name > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Faggregates.name%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8ufA%2FwkmWiC3nxg1BzqEHFbaiEIgeJsE9ZDnbuhO%2BUQ%3D&reserved=0>: > "{{ ?? }}" --> here we need to use aggr1,aggr3,aggr2...from variable ' > aggregates' > hostname: "{{ ?? }}" --> here we need to use > Cluster1,Cluster2,Cluster3...from variable 'aggregates' > use_python_keys: true > register: vol_data > loop: "{{ ?? }}" > loop_control: > label: "{{ ?? }}" > no_log: false > - debug: var=vol_data > ... > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CANGEjuX20ndh8%2Bh_oCx8nGGBJTZ4oeEFfGQb0tWy6MXAuhTucA%40mail.gmail.com > <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCANGEjuX20ndh8%252Bh_oCx8nGGBJTZ4oeEFfGQb0tWy6MXAuhTucA%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd01184be3425441edc7f08db1cabea6c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638135296936895989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lea%2BifEPgzyFrr9eNStca9YuxchbHNAhmpZAS5CU%2FqA%3D&reserved=0> > . > > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/03325950-FBD3-49F2-82BC-485D290BDEE1%40nist.gov > <https://groups.google.com/d/msgid/ansible-project/03325950-FBD3-49F2-82BC-485D290BDEE1%40nist.gov?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CANGEjuXJdpJe7gBCCY1nQYxhz44DuQA4V7c5qVXAakPCe_-hEA%40mail.gmail.com.
