title: flatten ansible result using jinja2
body: <p>I am getting a list of elements of the same structure using ansible, it looks a bit like the following:</p>
  <pre><code>results: [
    {
      &quot;a&quot;: &quot;foo&quot;,
      &quot;b&quot;: &quot;bar&quot;,
      &quot;c&quot;: [
        {&quot;c1&quot;: ...},
        {&quot;c2&quot;: ...}
        {&quot;c3&quot;: ...}]
    },
    {
      &quot;a&quot;: &quot;foo2&quot;,
      &quot;b&quot;: &quot;bar2&quot;,
      &quot;c&quot;: [
        {&quot;c4&quot;: ...},
        {&quot;c5&quot;: ...}
        {&quot;c6&quot;: ...}]
    }
  ]
  </code></pre>
  <p>I would need to iterate over all subelements of c - of all elements, so what I want is a list of the elements: c1, c2, c3, c4, c5, c6...</p>
  <p>Normally I would use a nested loop, but since ansible is using jinja2s filters, I have no clue on how to accomplish that. I am totally new to this kind of data transformation.</p>
  <hr />
  <p>To give some context, the actual code is:</p>
  <pre><code>- name: Find log files that are older than 1 day
    find:
      paths: &quot;{{ item }}&quot;
      age: 1d
      recurse: no
    register: oldLogs
    loop:
      - &quot;/var/log&quot;
      - &quot;/home/user/log&quot;
  
  - name: print files
    debug:
      msg: &quot;{{ oldLogs.results | &lt;some filters here&gt; }}\n&quot;
  
  </code></pre>
  <p>Yes, I know I could pass a list of paths to find instead, but that's not the way I want to go, instead I would like to learn on how to use filters in such a situation.</p>