title: Append to dict inside a list in Ansible
body: <p>I have the following structure(s) that I need to merge into a single list of dicts.</p>
  
  <p>I can change the syntax/structure of the <code>secrets</code> list (into something else if easier).</p>
  
  <pre><code>vars:
    users:
      - name: foo
        database: foodb
      - name: bar
        database: bardb
  
    secrets:
      - name: foo
        password: foopass
      - name: bar
        password: barpass
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>users:
    - name: foo
      database: foodb
      password: foopass
    - name: bar
      database: bardb
      password: barpass
  </code></pre>
  
  <p>I have tried several filters to no avail, the closest I've come is this:</p>
  
  <pre><code>tasks: 
    - set_fact: foo: "{{ foo|default([]) + [item | combine(secrets, recursive=True)] }}"
      with_items: "{{ users }}"
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>fatal: [localhost]: FAILED! =&gt; {"failed": true, "msg": "|combine expects dictionaries, got u'foo'"}
  </code></pre>