# Having issues using a variable in a playbook

**URL:** <https://forum.ansible.com/t/having-issues-using-a-variable-in-a-playbook/17254>\
**Category:** Ansible Project\
**Created:** [January 14, 2015, 12:15am UTC](https://forum.ansible.com/t/having-issues-using-a-variable-in-a-playbook/17254 "2015-01-14T00:15:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Arntzen](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@Benjamin\_Arntzen](https://forum.ansible.com/u/Benjamin_Arntzen)\
**Post date:** [January 14, 2015, 12:15am UTC](https://forum.ansible.com/t/having-issues-using-a-variable-in-a-playbook/17254/1 "2015-01-14T00:15:49Z")

</div>

Hi there,

I’m trying to build python 3.4.2 in a semi-idempotent way. I see mpdehaan’s comments on it and didn’t have any issues following those.

The issue I’m having is that the variables defined in common.yml aren’t being carried through to the second play (python-app-server). I would like to simply define vars\_files in the first play and have it carry forward. Am I just thinking about it wrong?

Here’s my playbook’s site.yml file, as I would like it to look:  
`

---

<div class="post-metadata">

**Author:** ![Tom\_Bamford](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@Tom\_Bamford](https://forum.ansible.com/u/Tom_Bamford)\
**Post date:** [January 14, 2015, 3:02am UTC](https://forum.ansible.com/t/having-issues-using-a-variable-in-a-playbook/17254/2 "2015-01-14T03:02:32Z")

</div>

Hi Benjamin

Look at specifying variables using group\_vars or host\_vars (see [http://docs.ansible.com/intro\_inventory.html#splitting-out-host-and-group-specific-data](http://docs.ansible.com/intro_inventory.html#splitting-out-host-and-group-specific-data))

There is a special group ‘all’ of which all hosts are automatically a member.

Regards  
Tom

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 14, 2015, 12:57pm UTC](https://forum.ansible.com/t/having-issues-using-a-variable-in-a-playbook/17254/3 "2015-01-14T12:57:41Z")

</div>

vars/vars\_files/registered vars are in the single play scope, if you  
want common.yml vars present in other plays you need to import it  
there also.
