# Ansible 2.0: interpolate filenames with variables

**URL:** <https://forum.ansible.com/t/ansible-2-0-interpolate-filenames-with-variables/19721>\
**Category:** Ansible Project\
**Created:** [November 10, 2015, 9:16am UTC](https://forum.ansible.com/t/ansible-2-0-interpolate-filenames-with-variables/19721 "2015-11-10T09:16:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikas\_Bodke](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@Vikas\_Bodke](https://forum.ansible.com/u/Vikas_Bodke)\
**Post date:** [November 10, 2015, 9:16am UTC](https://forum.ansible.com/t/ansible-2-0-interpolate-filenames-with-variables/19721/1 "2015-11-10T09:16:57Z")

</div>

I have the following playbook working in Ansible 1.9, where in i like to include a play at run time based on variable passed either as command line argument or declared under ‘vars’.

```auto
  - name: include another play
    vars:
      var_name_1: var_value_1
      var_name_2: var_value_2
    include: "code/folder/{{ var_name_1 }}.yml"

```

The playbook included the play inside the file ‘code/folder/var\_value\_1.yml’ successfully. However the same play book throws the following error in Ansible 2.0

> ERROR! the file\_name ‘code/folder/{{ var\_name\_1 }}.yml’ does not exist, or is not readable

As i understand, Ansible 2.0 is not able to interpolate filenames with variables.  
The same issue exists for ‘vars\_files’ also, for which i used the ‘include\_vars’ under ‘tasks’ as a workaround to include var files at runtime.

Questions:

1. Why was this feature removed or excluded, assuming my code is valid for 2.0?

2. What are the options for including a play at runtime in Ansible 2.0?

posted from [http://stackoverflow.com/questions/33623050/ansible-2-0-interpolate-filenames-with-variables](http://stackoverflow.com/questions/33623050/ansible-2-0-interpolate-filenames-with-variables)
