# Cannot use variable for specifying role

**URL:** <https://forum.ansible.com/t/cannot-use-variable-for-specifying-role/17571>\
**Category:** Ansible Project\
**Created:** [February 20, 2015, 10:24am UTC](https://forum.ansible.com/t/cannot-use-variable-for-specifying-role/17571 "2015-02-20T10:24:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdullah\_Al\_Nahian](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@Abdullah\_Al\_Nahian](https://forum.ansible.com/u/Abdullah_Al_Nahian)\
**Post date:** [February 20, 2015, 10:24am UTC](https://forum.ansible.com/t/cannot-use-variable-for-specifying-role/17571/1 "2015-02-20T10:24:28Z")

</div>

Previously, I was using variable to locate role so that I can execute different role based on variables i pass through command line argument and using variable file.

In my playbook,  
`  
roles:

- build\_init
- plugins
- “{{recipe\_dir}}/{{recipe}}/cook”

`

And I run this from command line with

`ansible-playbook builder.yml -e "recipe=edef"`

It worked fine in Ansible 1.7.1

Once I updated to Ansible 1.8.4 this stopped working and I get following error

`ERROR: cannot find role in /opt/ekitchen/ansibles/ece/roles/{{recipe_dir}}/{{recipe}}/cook or /opt/ekitchen/ansibles/ece/{{recipe_dir}}/{{recipe}}/cook or /etc/ansible/roles/{{recipe_dir}}/{{recipe}}/cook`

Is this a bug or is there any way or getting around this?

Thanks in advance.

- Nahian
