title: How do I debug Ansible includes and dependencies?
body: <p>I've joined a project which has a large number of playbooks and roles, and which makes heavy use of <a href="http://docs.ansible.com/ansible/latest/include_module.html" rel="nofollow noreferrer"><code>include</code></a> (often in a nested fashion) in order to include playbooks/roles within existing playbooks/roles.  (Whether this is good or bad practice should be considered out of scope of this question, because it's not something I can immediately change.  Note also that <a href="http://docs.ansible.com/ansible/latest/include_role_module.html" rel="nofollow noreferrer"><code>include_role</code></a> is not used because these playbooks were written well before 2.2 was out, and are still in the process of being updated.)</p>
  
  <p>Normally when <a href="http://docs.ansible.com/ansible/latest/playbooks_intro.html#executing-a-playbook" rel="nofollow noreferrer">running</a> <a href="https://linux.die.net/man/1/ansible-playbook" rel="nofollow noreferrer"><code>ansible-playbook</code></a>, the output just shows each task being run, but it does not show the includes which pull in extra tasks.  This makes it hard to how the overall flow jumps around between playbooks.  In contrast, <a href="http://docs.ansible.com/ansible/latest/include_vars_module.html" rel="nofollow noreferrer"><code>include_vars</code></a> tasks <em>are</em> included in the output.  I'm guessing this is because it's an Ansible module, whereas <a href="http://docs.ansible.com/ansible/latest/include_module.html#notes" rel="nofollow noreferrer"><code>include</code> isn't really a module</a>.</p>
  
  <p>So without having to modify the playbooks, is there way to run playbooks which shows the following?</p>
  
  <ul>
  <li>when <code>include</code> directives are triggering, and</li>
  <li>(ideally) also the exact files which are being included, since it's not always obvious how relative paths are converted into absolute paths</li>
  </ul>
  
  <p>I've found lots of advice on various ways to debug playbooks, but nothing which achieves this.  Bonus points if it also shows when roles are being included via <a href="http://docs.ansible.com/ansible/latest/playbooks_roles.html#role-dependencies" rel="nofollow noreferrer"><code>meta</code> role dependencies</a>!</p>
  
  <p>I'm aware that there are tools such as <a href="https://github.com/nickjj/ansigenome" rel="nofollow noreferrer">ansigenome</a> which do static analysis of playbooks, but I'm hoping for something which can output the information at playbook run-time, for any playbook I choose to invoke.</p>
  
  <p>If it's not currently possible, would it be a reasonable feature request?</p>