# Variables on Extra-Vars within Extra-Vars-File

**URL:** <https://forum.ansible.com/t/variables-on-extra-vars-within-extra-vars-file/38439>\
**Category:** Ansible Project\
**Created:** [September 14, 2023, 4:42pm UTC](https://forum.ansible.com/t/variables-on-extra-vars-within-extra-vars-file/38439 "2023-09-14T16:42:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poseidon\_Olympian](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Poseidon\_Olympian](https://forum.ansible.com/u/Poseidon_Olympian)\
**Post date:** [September 14, 2023, 4:42pm UTC](https://forum.ansible.com/t/variables-on-extra-vars-within-extra-vars-file/38439/1 "2023-09-14T16:42:18Z")

</div>

Hello Groups,

Is there any way that we can have a variable within a variable-file?

Example:  
ansible-playbook -i localhost -e “test=var1 some=ex\_1” -e “@files/dev/sample\_ex\_1.yml”

Desired:

ansible-playbook -i localhost -e “test=var1 some=ex\_1” -e “@files/dev/sample\_{{ some }}.yml”

Thank you…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 14, 2023, 7:49pm UTC](https://forum.ansible.com/t/variables-on-extra-vars-within-extra-vars-file/38439/2 "2023-09-14T19:49:54Z")

</div>

No, buton the other hand... its still shell:

ansible-playbook -i localhost -e "test=var1  
some=${THIS\_IS\_AN\_ENV\_VAR}" -e  
"@files/dev/sample\_${THIS\_IS\_AN\_ENV\_VAR}.yml"

---

<div class="post-metadata">

**Author:** ![Poseidon\_Olympian](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Poseidon\_Olympian](https://forum.ansible.com/u/Poseidon_Olympian)\
**Post date:** [September 14, 2023, 8:42pm UTC](https://forum.ansible.com/t/variables-on-extra-vars-within-extra-vars-file/38439/3 "2023-09-14T20:42:41Z")

</div>

Yes, that is what I’m actually doing by putting the same value.

Thank you
