title: Ansible create directories from a list
body: <p>I want to create some directories from a list I have in my <code>vars/main.yml</code>.</p>
  
  <pre><code>- app_root:
      network_prod:   "/var/www/prod/network/app"
      database_prod:  "/var/www/prod/db/app"
  </code></pre>
  
  <p>My <code>tasks/main.yml</code> so far has this:</p>
  
  <pre><code>- name: Create application directory structure
    file: 
      path: "{{ item }}"
      state: directory
      mode: 755
    with_items:
      - app_root
  </code></pre>
  
  <p>but doesn't work. I thought this could be achieved using <code>with_dict</code> and I also tried:</p>
  
  <pre><code>- name: Create application directory structure
    file: 
      path: "{{ item.value }}"
      state: directory
      mode: 755
    with_dict:
      - app_root
  </code></pre>
  
  <p>but I got: <code>fatal: [vagrant.dev] =&gt; with_dict expects a dict</code>.</p>
  
  <p>I've read all about <a href="http://docs.ansible.com/playbooks_loops.html#looping-over-hashes" rel="nofollow">looping-over-hashes</a>, but this doesn't seem to work.</p>
  
  <p>The reason I'm using this notation is because I use these variables elsewhere as well and I need to know how to call them.</p>