# Running a dynamically generated playbook.

**URL:** <https://forum.ansible.com/t/running-a-dynamically-generated-playbook/31965>\
**Category:** Ansible Project\
**Created:** [January 14, 2020, 7:55am UTC](https://forum.ansible.com/t/running-a-dynamically-generated-playbook/31965 "2020-01-14T07:55:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag\_Negi](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Anurag\_Negi](https://forum.ansible.com/u/Anurag_Negi)\
**Post date:** [January 14, 2020, 7:55am UTC](https://forum.ansible.com/t/running-a-dynamically-generated-playbook/31965/1 "2020-01-14T07:55:25Z")

</div>

Hi, I have a requirement to run a dynamically generated playbook from a main playbook. The idea is to run only a main playbook which would be generating a sub-playbook and it would be run from one of the tasks in the main playbook. How do I achieve this ?

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [January 14, 2020, 10:24am UTC](https://forum.ansible.com/t/running-a-dynamically-generated-playbook/31965/2 "2020-01-14T10:24:04Z")

</div>

It's not possible for 2 reasons. 1) A playbook can't be "run from one of the  
tasks". 'import\_playbook' is not a task. 2) The file that should be imported  
by 'import\_playbook' must be ready then the playbook started. Therefor it  
can't be "dynamically generated playbook from a main playbook".

HTH,

&nbsp;&nbsp;-vlado
