# Multiple level include directives

**URL:** <https://forum.ansible.com/t/multiple-level-include-directives/12097>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [November 20, 2012, 1:52pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097 "2012-11-20T13:52:34Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [November 20, 2012, 1:52pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/1 "2012-11-20T13:52:34Z")

</div>

Great!

They are reasonable, but this needs to go into 1.0 versus 0.9, so next release.

(There is no numerical significance to 1.0)

---

<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:** [November 20, 2012, 1:53pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/2 "2012-11-20T13:53:23Z")

</div>

One quick follo wup.

Also, I may suggest waiting until we have cleaned up our template  
logic. We need to do the "multiple basedir" thing first, as this is  
already somewhat a source of confusion where a relatively pathed file  
lives with includes at multiple directly levels.

---

<div class="post-metadata">

**Author:** ![Christopher\_Brumgard](https://avatars.discourse-cdn.com/v4/letter/c/3da27b/32.png) [@Christopher\_Brumgard](https://forum.ansible.com/u/Christopher_Brumgard)\
**Post date:** [November 22, 2012, 6:34am UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/3 "2012-11-22T06:34:23Z")

</div>

When do you think that the template logic will be cleaned up and the multiple basedir will be done? Is this something that I could also help with?

---

<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:** [November 22, 2012, 1:33pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/4 "2012-11-22T13:33:28Z")

</div>

No idea. Template code must be refactored first, and this can't  
start until we release 1.0

It is unlikely that this is something I'm going to work on, help is  
welcome, but this area of code is both extremely important and  
complicated, so just changing it to do multiple basedirs is not the  
solution we are looking for.

It's going to be closer to a mini-rewrite.

---

<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:** [November 22, 2012, 1:36pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/5 "2012-11-22T13:36:44Z")

</div>

FYI should you want to try this

It at least affects the signature of every template and template\_ds  
call in the app, and probably indicates that various things should  
keep up a self.basedirs and just pass that context into the template  
class, rather than passing a basedir around.

In some cases basedirs will be the union of the play and the task  
basedirs, etc. It would also need to consider handler basedirs (if  
imported), the cwd, etc.

---

<div class="post-metadata">

**Author:** ![Christopher\_Brumgard](https://avatars.discourse-cdn.com/v4/letter/c/3da27b/32.png) [@Christopher\_Brumgard](https://forum.ansible.com/u/Christopher_Brumgard)\
**Post date:** [February 5, 2013, 5:24pm UTC](https://forum.ansible.com/t/multiple-level-include-directives/12097/6 "2013-02-05T17:24:59Z")

</div>

Michael,

I saw that ansible 1.0 now supports arbitrary depth playbook inclusion so having me augment the code will no longer be necessary. I did a github fork of the project for version 0.8 that added rudimentary recursion. I see about removing that fork.

Thanks.
