# Include\_tasks docs lack info on tail recursion

**URL:** <https://forum.ansible.com/t/include-tasks-docs-lack-info-on-tail-recursion/2306>\
**Category:** Project Discussions\
**Tags:** include\_tasks, playbook, documentation\
**Created:** [November 12, 2023, 2:02pm UTC](https://forum.ansible.com/t/include-tasks-docs-lack-info-on-tail-recursion/2306 "2023-11-12T14:02:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 13, 2023, 4:43pm UTC](https://forum.ansible.com/t/include-tasks-docs-lack-info-on-tail-recursion/2306/3 "2023-11-13T16:43:47Z")

</div>

We’ll need to answer a few fundamental questions before we can get this documented. Here’s my short list:

1. Question for the Steering Committee: Is this an intended feature that will be carried into the future, or is this merely a side effect of the way ~~`import_tasks`~~ `include_tasks` is implemented which could disappear in a future release?

2. Does this work for any other flavors of `include_*` or `import_*`? If so, the scope of the question just got a bit creepier. (See what I did there? 🙂

3. What circumstances prevent tail recursion? ~~I’ve found by trial and error that having a `vars:` on the last task in the included task files’ last step is one such breaker.~~ [Edit: The error I incurred, “… maximum recursion depth exceeded”, was due to a variable defined in terms of itself, not that the final `include_tasks` step had a `vars:` section.] What else?

Other questions? Maybe someone who knows how it’s implemented would have additional insights…

Tail recursion is an “in-the-weeds” topic anyway. How do we provide enough technical detail to cover it while not overwhelming the `include_tasks` doc? Should it be split between the `include_tasks` doc and the `tips-n-tricks` page, or all in one place? Should an example be added the to `async:` doc (since async job queue management is a practical example of its application)?

---

_[View the full topic](https://forum.ansible.com/t/include-tasks-docs-lack-info-on-tail-recursion/2306)._
