# Variables in playbook names in "include" statement

**URL:** <https://forum.ansible.com/t/variables-in-playbook-names-in-include-statement/16402>\
**Category:** Ansible Project\
**Created:** [October 2, 2014, 12:52pm UTC](https://forum.ansible.com/t/variables-in-playbook-names-in-include-statement/16402 "2014-10-02T12:52:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wojciech\_Korzenny](https://avatars.discourse-cdn.com/v4/letter/w/eada6e/32.png) [@Wojciech\_Korzenny](https://forum.ansible.com/u/Wojciech_Korzenny)\
**Post date:** [October 2, 2014, 12:52pm UTC](https://forum.ansible.com/t/variables-in-playbook-names-in-include-statement/16402/1 "2014-10-02T12:52:30Z")

</div>

Hi,

I have a playbook where I want to include another playbook which name is depended on variable passed in --extra\_vars:

$ ansible-playbook test.yaml --extra\_vars=“variable=XYZ”

Inside test.yaml:

TASK1  
TASK2

-include: another\_playbook\_{{variable}}.yaml

TASK3  
TASK4

The problem is that ansible throws exception that “another\_playbook\_{{variable}}.yaml” doesn’t exist instead of substitute “{{variable}}” with value given in command line (I expect to execute another\_playbook\_XYZ.yaml).  
Do you see any possibility to work around it?

Thanks

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [October 3, 2014, 6:56pm UTC](https://forum.ansible.com/t/variables-in-playbook-names-in-include-statement/16402/2 "2014-10-03T18:56:12Z")

</div>

Hi Wojciech,

Please see the response I just sent to Alexey here in this thread: [https://groups.google.com/forum/#!topic/ansible-project/NWnFOzR9Ajc](https://groups.google.com/forum/#!topic/ansible-project/NWnFOzR9Ajc)

The problem you’re running into has the same underlying cause.

Thanks!
