title: Ansible - how to evaluate role_path variable
body: <p>I'm trying to evaluate the value of the <code>role_path</code> variable in order to use it in other roles as a reference point. The problem is, however, when my variable is used in another role, it has the value of the other role, and not of when it was declared. </p>
  
  <p>I am getting around this by using an <code>echo</code> command of the current variable's value and registering the output as per below. </p>
  
  <pre><code>- name: get ansible base path from current role_path
    command: echo {{ role_path }}/../../
    register: ansible_base_path_out
  
  - name: save ansible base path variable for future use
    set_fact:
      ansible_base_path: "{{ ansible_base_path_out.stdout }}"
  </code></pre>
  
  <p>Is this the best way to do this or is there a more eloquent solution?</p>