Ansible role_path undefined error
<p>I have a task file that looks like this:</p>

<pre><code>- name: Drop schemas
  mysql_db: state=import name=mysql target={{ role_path }}/files/schemas/drop-imdb-perf.sql login_user={{ MYSQL_ROOT_USER }} login_password={{ MYSQL_ROOT_PWD }} login_host={{ inventory_hostname }}
</code></pre>

<p>I'm invoking it from a playbook that looks like this:</p>

<pre><code>- name: Drop mySQL data
  gather_facts: no
  hosts: imdb
  connection: local
  tags:
    - mysql-data-drop
  tasks:
    - include: ../roles/mysql/tasks/drop-perf.yml
</code></pre>

<p>I'm using Ansible version 1.9.4 so I'm thinking <code>role_path</code> should be a valid variable.</p>

<p>But when I run the playbook, I get this output:</p>

<pre><code>TASK: [Drop schemas] **************************************************
fatal: [imdb] =&gt; One or more undefined variables: 'role_path' is undefined
</code></pre>

<p>I can't figure out why <code>role_path</code> is undefined. According to the <a href="http://docs.ansible.com/ansible/playbooks_variables.html" rel="nofollow">ansible docs</a>, it seems like for versions 1.8 and above it should be populated with the directory of the role in question, but I'm clearly mistaken about something or other.</p>