title: Ansible : double loop into json file
body: <p>I have as a source a json file that contains a list of blocks and data. from which i would like to extract information to create security rules, using a double loop in ansible.</p>
  <p>Below an example from my json file :</p>
  <pre><code>[
     {
        &quot;Name&quot;:&quot;Some_name&quot;,
        &quot;NetworkFlow&quot;:[
           {
              &quot;GroupName&quot;:&quot;Test1&quot;,
              &quot;Type&quot;:&quot;Ingress&quot;,
              &quot;Env&quot;:&quot;dev&quot;,
              &quot;Server&quot;:[
                 &quot;192.168.1.1&quot;,
                 &quot;192.168.1.2&quot;,
                 ...
              ],
              &quot;Service&quot;:[
                 {
                    &quot;Protocol&quot;:&quot;TCP&quot;,
                    &quot;Port&quot;:&quot;443&quot;
                 },
                 {
                    &quot;Protocol&quot;:&quot;UDP&quot;,
                    &quot;Port&quot;:&quot;21&quot;
                 },
                 ....
              ]
           },
           ....
        ]
     }
  ]
  </code></pre>
  <p>This is for a generic deployment, and for each &quot;NetworkFlow&quot; section, i have to loop in the list of servers and also in the list of protocols and ports to get a simular parsing like the below:</p>
  <pre><code>#rule= Server,Protocol,Port,Type,Env,GroupName
  192.168.1.1,TCP,443,Ingress,Dev,Test1
  192.168.1.2,TCP,443,Ingress,Dev,Test1
  192.168.1.1,UDP,21,Ingress,Dev,Test1
  192.168.1.2,UDP,21,Ingress,Dev,Test1
  </code></pre>
  <p>I tried with_nested but it doesn't work, Any idea to deal with that please?</p>