title: Ansible nested loops using value form one loop to another
body: <p>I am facing issue while writing nested loops in ansible, for below iteration I am getting error
  ansible role I am using looks like below</p>
  <p>The conditional check 'item[0]['value']['from'] == COMPONENT_NAME' failed. The error was: error while evaluating conditional (item[0]['value']['from'] == COMPONENT_NAME): 'item' is undefined</p>
  <p>Role</p>
  <pre><code>- name: create config file 
    template:
      src: &quot;{{template_source}}/{{COMPONENT_NAME}}/sessions/{{ item[0]['value']['protocol']}}/{{item[0]['value']['from_template']}}&quot;
      dest: &quot;{{dest_folder}}/{{app}}/{{instance_name}}/{{COMPONENT_NAME}}/{{VENUE}}/Config/Repo/session/{{item[0]['value']['protocol']}}/{{item[1]}}.json&quot;
      mode: 0755
    vars:
      dest_file_name: &quot;{{instance_name}}_{{COMPONENT_NAME}}_{{VENUE}}_{{item[0]['key']}}&quot;
      mbFlag: &quot;{{item[0]['value']['broker'] |  default('False')}}&quot;
    when: item[0]['value']['from'] == COMPONENT_NAME
    with_nested:
      - &quot;{{ connections | dict2items }}&quot;
      - &quot;{{myFileList['from_' + COMPONENT_NAME +'_'+ VENUE +'_'+ item[0]['value']['to']].split(',') }}&quot;
  </code></pre>
  <p>yml file having below variable and I am iterating over it.</p>
  <pre><code>
  myFileList: 
     {
      from_et_AG_zp: DevOpsTest_et_zp_AG_zp, 
      from_et_AG_sSP: 'DevOpsTest_et_sSP_AG_US,DevOpsTest_et_sSP_AG_BA,DevOpsTest_et_sSP_AG_chex',
      from_et_AG_esb: DevOpsTest_et_esb_AG_ABC, 
      from_et_BA_Y_zp: DevOpsTest_et_zp_BA_Y_zp,
      from_et_BA_Y_sSP: 'DevOpsTest_et_sSP_BA_Y_US,DevOpsTest_et_sSP_BA_Y_BA,DevOpsTest_et_sSP_BA_Y_chex',
      from_et_BA_Y_esb: DevOpsTest_et_esb_BA_Y_ABC, 
      from_et_BA_zp: DevOpsTest_et_zp_BA_zp,
      from_et_BA_sSP: 'DevOpsTest_et_sSP_BA_US,DevOpsTest_et_sSP_BA_BA,DevOpsTest_et_sSP_BA_chex',
      from_et_BA_esb: DevOpsTest_et_esb_BA_ABC, 
      from_zp_zp_esb: DevOpsTest_zp_esb_zp_ABC,
      from_SP_SP_esb: DevOpsTest_SP_esb_SP_ABC, 
      from_SSS_SSS_esb: DevOpsTest_SSS_esb_SSS_ABC,
      
      to_zp_zp_es: DevOpsTest_et_zp_zp_es, 
      to_sSP_BA_es: DevOpsTest_et_sSP_BA_es,
      to_sSP_chex_es: DevOpsTest_et_sSP_chex_es, 
      to_sSP_US_es: DevOpsTest_et_sSP_US_es,
      to_esb_ABC_es: DevOpsTest_et_esb_ABC_es, 
      to_esb_ABC_zp: DevOpsTest_zp_esb_ABC_zp,
      to_esb_ABC_SP: DevOpsTest_SP_esb_ABC_SP, 
      to_esb_ABC_SSS: DevOpsTest_SSS_esb_ABC_SSS
      
      }
  
  
  
  connections:
    et_etb:
      from: et
      to: etb
      from_template: et_etb.json
      to_template: etb_et.json
      protocol: ZERO
  </code></pre>