title: How to select a nested json value for each host in my inventory and set_fact for reuse later
body: <p>I am fairly new to Ansible and using the vmware_guest_disk_info module to produce the following json:</p>
  <pre><code>{
  &quot;msg&quot;: {
      &quot;changed&quot;: false,
      &quot;msg&quot;: &quot;All items completed&quot;,
      &quot;results&quot;: [
          {
              &quot;ansible_loop_var&quot;: &quot;result_item&quot;,
              &quot;changed&quot;: false,
              &quot;failed&quot;: false,
              &quot;guest_disk_info&quot;: {
                  &quot;0&quot;: {
                      &quot;capacity_in_bytes&quot;: 103079215104,
                      &quot;capacity_in_kb&quot;: 100663296,
                      &quot;controller_bus_number&quot;: 0,
                      &quot;controller_key&quot;: 1000,
                      &quot;controller_type&quot;: &quot;lsilogicsas&quot;,
                      &quot;key&quot;: 2000,
                      &quot;label&quot;: &quot;Hard disk 1&quot;,
                      &quot;summary&quot;: &quot;100,663,296 KB&quot;,
                      &quot;unit_number&quot;: 0
                  },
                  &quot;1&quot;: {
                      &quot;capacity_in_bytes&quot;: 8589934592,
                      &quot;capacity_in_kb&quot;: 8388608,
                      &quot;controller_bus_number&quot;: 0,
                      &quot;controller_key&quot;: 1000,
                      &quot;controller_type&quot;: &quot;lsilogicsas&quot;,
                      &quot;key&quot;: 2001,
                      &quot;label&quot;: &quot;Hard disk 2&quot;,
                      &quot;summary&quot;: &quot;8,388,608 KB&quot;,
                      &quot;unit_number&quot;: 1
                  }
              },
              &quot;invocation&quot;: {
                  &quot;module_args&quot;: {
                      &quot;name&quot;: &quot;server1&quot;,
                  }
              },
              &quot;result_item&quot;: {
                  &quot;vmname&quot;: &quot;server1&quot;
              }
          },
          {
              &quot;ansible_loop_var&quot;: &quot;result_item&quot;,
             &quot;changed&quot;: false,
              &quot;failed&quot;: false,
              &quot;guest_disk_info&quot;: {
                  &quot;0&quot;: {
                      &quot;capacity_in_bytes&quot;: 103079215104,
                      &quot;capacity_in_kb&quot;: 100663296,
                      &quot;controller_bus_number&quot;: 0,
                      &quot;controller_key&quot;: 1000,
                      &quot;controller_type&quot;: &quot;lsilogicsas&quot;,
                      &quot;key&quot;: 2000,
                      &quot;label&quot;: &quot;Hard disk 1&quot;,
                      &quot;summary&quot;: &quot;100,663,296 KB&quot;,
                      &quot;unit_number&quot;: 0
                  }
              },
              &quot;invocation&quot;: {
                  &quot;module_args&quot;: {
                      &quot;name&quot;: &quot;server2&quot;,
                  }
              },
              &quot;result_item&quot;: {
                  &quot;vmname&quot;: &quot;server2&quot;
              }
          }
      ]
  }
  </code></pre>
  <p>}</p>
  <p>I need to be able to extract the unit_number from each host and then reference each hosts own unit_number(s) later in another task(there can be multiple unit numbers per host).  It seems everything I tried just overwrites the previous value and I only end up with the last value of the last host.</p>
  <p>I have tried:</p>
  <pre><code>set_fact:
    facts: &quot;{{ diskOutput.results.guest_disk_info.values()|map(attribute='unitNumber'} | list }}&quot;
  </code></pre>
  <p>But I only get the last hosts data.</p>