title: Q: Ansible - How can I merge 2 lists of hashes with a common key/value pair
body: <p>How can I merge 2 lists of hashes based on a key/value pair, using Ansible 2.4.4</p>
  
  <pre><code>"foo": [
      {
          "hostname": "web1.example.com",
          "guid": "73e85eb2-2ad5-4699-8a09-adf658a11ff2"
      },
      {
          "hostname": "web2.example.com",
          "guid": "827025fe-f13c-4fc8-ba51-7ff582596bbd"
      },
      {
          "hostname": "web3.example.com",
          "guid": "bba27304-c1bb-4889-aa44-125626be8488"
      }
  ]
  
  "bar": [
      {
          "ipaddress": "1.1.1.1",
          "guid": "73e85eb2-2ad5-4699-8a09-adf658a11ff2"
      },
      {
          "ipaddress": "2.2.2.2",
          "guid": "827025fe-f13c-4fc8-ba51-7ff582596bbd"
      },
      {
          "ipaddress": "3.3.3.3",
          "guid": "bba27304-c1bb-4889-aa44-125626be8488"
      }
  ]
  </code></pre>
  
  <p>I want something like:</p>
  
  <pre><code>"foobar" : [
      {
          "hostname": "web1.example.com",
          "guid": "73e85eb2-2ad5-4699-8a09-adf658a11ff2",
          "ipaddress": "1.1.1.1"
      },
      {
          "hostname": "web2.example.com",
          "guid": "827025fe-f13c-4fc8-ba51-7ff582596bbd",
          "ipaddress": "2.2.2.2"
      },
      {
          "hostname": "web3.example.com",
          "guid": "bba27304-c1bb-4889-aa44-125626be8488",
          "ipaddress": "3.3.3.3"
      }
  ]
  </code></pre>
  
  <p>I've looked into several Ansible / Jinja2 filters including combine, union, map, custom plugins, but not having much success.  I need to be able to match on the guid.</p>