# relative paths with included playbooks

**URL:** <https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051>\
**Category:** Ansible Project\
**Created:** [October 30, 2012, 2:14am UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051 "2012-10-30T02:14:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![robstep](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@robstep](https://forum.ansible.com/u/robstep)\
**Post date:** [October 30, 2012, 2:14am UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/1 "2012-10-30T02:14:35Z")

</div>

Is there some way to get relative paths in included playbooks to be relative to themselves rather than their parent playbook? This would be useful for lumping the files and templates for a particular play together in a folder with that playbook.

If this isn’t currently possible but would be desirable, I’d be happy to attempt to add this functionality.

Thoughts?

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [October 30, 2012, 3:06am UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/2 "2012-10-30T03:06:05Z")

</div>

I think this is already the case, because in my case, where I have:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;provision.yml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;plays/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kickstart-boot.yml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kickstart-facts.yml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kickstart-media.yml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kickstart-post.yml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;templates/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kickstart/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ks.cfg

provision.yml

---

<div class="post-metadata">

**Author:** ![robstep](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@robstep](https://forum.ansible.com/u/robstep)\
**Post date:** [October 30, 2012, 4:29am UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/3 "2012-10-30T04:29:32Z")

</div>

No this isn’t what I see at all, perhaps it’s different for local\_action? I’ve been testing it with “copy” and whatever src i specify gets looked for in the parent playbook folder, not the child playbook.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 30, 2012, 12:00pm UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/4 "2012-10-30T12:00:54Z")

</div>

This feature is in plan for 0.9 and it will allow them to be relative to either.

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [October 30, 2012, 8:29pm UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/5 "2012-10-30T20:29:47Z")

</div>

Could the difference be explained by me including complete plays from a master playbook, while some people are using includes to include sets of tasks inside a play ?

Because this definitely works for me as I explained, and we have 40+ plays included in various playbooks (one level up). All plays have everything (local and remote actions) relative to the location of the play.

So you may have to give me an example in order to understand what you're doing.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 30, 2012, 8:52pm UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/6 "2012-10-30T20:52:37Z")

</div>

I will take care of this.

-- Michael

---

<div class="post-metadata">

**Author:** ![robstep](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@robstep](https://forum.ansible.com/u/robstep)\
**Post date:** [October 30, 2012, 9:34pm UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/7 "2012-10-30T21:34:57Z")

</div>

Michael is this something you’d welcome pull requests for? I’d really like this feature and so would be keen to help in some way (I actually already organize my plays in their own folders with their associated files but then get around the problem by using a dirty script to run each play individually in sequence).

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 30, 2012, 10:56pm UTC](https://forum.ansible.com/t/relative-paths-with-included-playbooks/12051/8 "2012-10-30T22:56:13Z")

</div>

I want to take the opportunity to refactor the way plays are dealt  
with, and have some rather specific things in mind that I want to  
(need to) accomplish.

I'm not clear how that will look yet, so I'd say you probably want to wait.

We do, however, have quite a large queue of other things if you want  
to pick something to work on, that would be great!
