# include not working

**URL:** <https://forum.ansible.com/t/include-not-working/27276>\
**Category:** Ansible Project\
**Created:** [April 14, 2018, 12:42am UTC](https://forum.ansible.com/t/include-not-working/27276 "2018-04-14T00:42:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juraj\_Papic1](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Juraj\_Papic1](https://forum.ansible.com/u/Juraj_Papic1)\
**Post date:** [April 14, 2018, 12:42am UTC](https://forum.ansible.com/t/include-not-working/27276/1 "2018-04-14T00:42:06Z")

</div>

Hi all

I have the following playbook  
!

---

<div class="post-metadata">

**Author:** ![Biswadip\_Dutta](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@Biswadip\_Dutta](https://forum.ansible.com/u/Biswadip_Dutta)\
**Post date:** [April 16, 2018, 12:15pm UTC](https://forum.ansible.com/t/include-not-working/27276/2 "2018-04-16T12:15:06Z")

</div>

Hi,  
I believe you should use import\_playbook to add a playbook in another playbook. See [here](https://docs.ansible.com/ansible/2.4/playbooks_reuse_includes.html).

---

<div class="post-metadata">

**Author:** ![Juraj\_Papic1](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Juraj\_Papic1](https://forum.ansible.com/u/Juraj_Papic1)\
**Post date:** [April 16, 2018, 11:46pm UTC](https://forum.ansible.com/t/include-not-working/27276/3 "2018-04-16T23:46:02Z")

</div>

Hello,

I test it but still the same issue, maybe is the wrong way, the idea is if the value es greater then run the other playbook.

thanks.

---

<div class="post-metadata">

**Author:** ![Biswadip\_Dutta](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@Biswadip\_Dutta](https://forum.ansible.com/u/Biswadip_Dutta)\
**Post date:** [April 17, 2018, 8:20am UTC](https://forum.ansible.com/t/include-not-working/27276/4 "2018-04-17T08:20:23Z")

</div>

I understand the problem now. You are trying to include a playbook under the tasks level which is not allowed. A file with only tasks are allowed to be included under tasks. See [here](http://docs.ansible.com/ansible/2.3/playbooks_roles.html#task-include-files-and-encouraging-reuse).

Also, conditionally adding playbooks is a feature request as per [this](https://github.com/ansible/ansible/issues/34281) from what I can find.

Maybe you can restructure 2.yml a bit. Check [here](http://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#conditional-imports) for reference.

---

<div class="post-metadata">

**Author:** ![Juraj\_Papic1](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Juraj\_Papic1](https://forum.ansible.com/u/Juraj_Papic1)\
**Post date:** [April 17, 2018, 9:17am UTC](https://forum.ansible.com/t/include-not-working/27276/5 "2018-04-17T09:17:43Z")

</div>

Hello,

Thanks for your help I will check the reference. but the strange thing is I did playbooks the same way for and I only have with this .
