Variables in playbook names in "include" statement

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

Hi Wojciech,

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

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

Thanks!