title: Get Absolute Path of File on Local Host
body: <p><a href="https://github.com/naftulikay/ansible-role-degoss" rel="nofollow noreferrer">One of my Ansible roles</a> allows users to execute a set of tests against a target host, leaving minimal impact, removing all traces of the test.</p>
  
  <p>One of the surprisingly difficult things to determine is absolute paths on the host running the playbook. Resolving files for <code>copy</code> seems to be <em>really</em> complicated, Ansible having a priority list for trying to resolve files.</p>
  
  <p>As part of my debugging information emitted when tests fail, I want to specify the absolute path of the file on the local host and the absolute path of the file on the remote host. The remote host is easy enough to query, but I can't seem to find a way to determine where the source file is coming from on the local host.</p>
  
  <p>Here's my task:</p>
  
  <pre><code>- copy: src={{ goss_file }} dest=/tmp/goss/ mode=0644
  </code></pre>
  
  <p><code>goss_file</code> is specified by the user as a role variable. What I'd like to do is determine the full absolute path of <code>goss_file</code> on the local machine running Ansible against remote hosts.</p>
  
  <p>Is there a way to do this? It would <em>significantly</em> help in the debugging I've been doing.</p>