# Absolute path for playbook.basedir + vars.playbook\_path

**URL:** <https://forum.ansible.com/t/absolute-path-for-playbook-basedir-vars-playbook-path/15670>\
**Category:** Ansible Project\
**Created:** [July 14, 2014, 11:57pm UTC](https://forum.ansible.com/t/absolute-path-for-playbook-basedir-vars-playbook-path/15670 "2014-07-14T23:57:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Shobe](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Nick\_Shobe](https://forum.ansible.com/u/Nick_Shobe)\
**Post date:** [July 14, 2014, 11:57pm UTC](https://forum.ansible.com/t/absolute-path-for-playbook-basedir-vars-playbook-path/15670/1 "2014-07-14T23:57:57Z")

</div>

Hey

I’ve been doing some lookup() local command jank to get the absolute directory path to my playbook where I store some additional non role specific config files… plabook\_basedir/files/playbookspecific.tar.gz. I then pass that path in to my various roles that require the centrally located file. This keeps my playbooks and files nice and tidy and makes sense in the playbook where I pass the search paths to my roles as myrole.files : “{{ playbook\_dir }}/files” which I then use to add to my file search path.

I noticed that the inventory\_path is absolute so I decided that rather than continue to use a lookup() to set the playbook base path, this should be provided by ansible and accurate to the local system path.

My proposed changes: [https://github.com/dingus9/ansible/commit/e9d14cdec5d02282a691d42d370c5b72456b034e](https://github.com/dingus9/ansible/commit/e9d14cdec5d02282a691d42d370c5b72456b034e) If this seems reasonable I’ll create a PR. The code is working, however if someone could suggest a test to run against playbooks that would help.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 15, 2014, 12:10am UTC](https://forum.ansible.com/t/absolute-path-for-playbook-basedir-vars-playbook-path/15670/2 "2014-07-15T00:10:47Z")

</div>

If you’d like to get something reviewed, definitely submit a pull request - though I’d like to see this without the extraneous whitespace changes that complicate the diff and code attribution.

My gut feeling is that rather than doing the “x or y”, os.path.abspath just needs to be called on the path, if defined, because this code seems to imply something a bit different.

I could be wrong though, in skimming, but I don’t see where it absoluting the path.

---

<div class="post-metadata">

**Author:** ![Nick\_Shobe](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Nick\_Shobe](https://forum.ansible.com/u/Nick_Shobe)\
**Post date:** [July 16, 2014, 3:16pm UTC](https://forum.ansible.com/t/absolute-path-for-playbook-basedir-vars-playbook-path/15670/3 "2014-07-16T15:16:40Z")

</div>

OK thanks, I updated and submitted a PR. Code is a little cleaner and should do what I need.

[https://github.com/ansible/ansible/pull/8165](https://github.com/ansible/ansible/pull/8165)
