Ansible custom nested loops with subelements
<p>This is brief and expressive data structure in my <code>vars/main.yml</code> file:</p>

<pre><code>webapp_dirs:
  - /var/www/example.com
  - /var/www/test.example.ru

webapp_acls:
  - dirs:
    - app
    - web
    - src
    - vendor
    perm: rX
    recursive: yes
  - dirs:
    - app/cache
    - app/logs
    perm: rwX
    recursive: no
</code></pre>

<p>I want to iterate over first list, then over second list, and finally over nested list in second list:</p>

<pre><code>for top_dir in webapp_dirs:
    for acl in webapp_acls:
        for dir in i.dirs:
               ....
</code></pre>

<p>I have <code>with_subelements</code> and <code>with_nested</code>, but they can not be combined. Is there any way to do what I want in ansible?</p>

<p><strong>UPD</strong></p>

<p>@chrism gave me a good idea, but I can not make outer loop work:</p>

<pre><code>- include: app-permissions.yml
  vars:
    webapp_dir: "{{ item }}"
  with_items:
    - /var/www/example.com
</code></pre>

<p><code>app-permissions.yml</code> contains inner loop over variables. This fails with error <code>{"failed": true, "msg": "ERROR! an unexpected type error occurred. Error was can only concatenate list (not \"str\") to list"}</code></p>