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: 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: 'aggr1'
hostname: 'Cluster1'
2nd loop iteration:
  aggregates.name: '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: "{{ ?? }}"   --> 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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANGEjuX20ndh8%2Bh_oCx8nGGBJTZ4oeEFfGQb0tWy6MXAuhTucA%40mail.gmail.com.

Reply via email to