title: Including vars into an Ansible playbook
body: <p>I wanted to give deploying django projects with ansible a shot but I'm stuck on what seems to be a pretty basic issue.</p>
  
  <p>I've created a basic playbook to deploy my Postgres server.</p>
  
  <pre><code>---
  - hosts: default
    remote_user: myusername
    become: yes
    become_method: sudo
    become_user: postgres
    vars:
      - include: vars/databases.yml
  
    tasks:
  
       - name: Ensure Postgres server is running
         service: name=postgresql state=started enabled=yes
  
      - name: Create postgres database
        postgresql_db:
          name: '{{ db_name }}'
          state: present
          encoding: 'UTF-8'
  </code></pre>
  
  <p>I run the playbook and I get this error</p>
  
  <pre><code>fatal: [default]: FAILED! =&gt; {"failed": true, "msg": "'db_name' is undefined"}
  </code></pre>
  
  <p>In order to keep all of my passwords and such out of version control I've created a directory vars. It's located in my project structure like this with all my ansible yaml files in deploy and all my vars files in the vars subdirectory.</p>
  
  <pre><code>..
  ├── deploy
  │   └── vars
  ..
  ├── myproject
  ├── manage.py
  └── utils
  
  
  # var/databases.yml
  db_name: &lt;database name&gt;
  </code></pre>
  
  <p>What's going on here?</p>
  
  <p><strong>Update:</strong> Added contents of var/databases.yml as requested.</p>