# Playbook cannot find out the variable which set in global vars file.

**URL:** <https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659>\
**Category:** Ansible Project\
**Created:** [April 10, 2013, 7:37am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659 "2013-04-10T07:37:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [April 10, 2013, 7:37am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/1 "2013-04-10T07:37:14Z")

</div>

I define the global variable in group\_vars/all. But playbook cannot find out the variable. Please see the red part.

My ansible is 1.1.

/etc/ansible/hosts is:

192.168.126.149

/etc/ansible/group\_vars/all is:  
test: hello

my playbook is:

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [April 10, 2013, 7:48am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/2 "2013-04-10T07:48:54Z")

</div>

​the variable is not resolved in the "name of the task"​, which is what you  
see here (as you didn't set a name, the literal task entry is used as a  
name)  
you need to execute ansible-playbook verbosely (with the -v switch)

then you should see the value in the extra info

(I think there is an issue/PR addressing this, as to show the debug message  
by default)

&nbsp;&nbsp;Serge

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [April 10, 2013, 8:02am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/3 "2013-04-10T08:02:22Z")

</div>

Thank you. But when I use vars file in playbook, the task debug can show variable value.

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [April 10, 2013, 8:09am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/4 "2013-04-10T08:09:06Z")

</div>

hey Guo,

did you put a -vv in the command line, if not try with ansible -vv or ansible-playbook -vv

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [April 11, 2013, 9:13am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/5 "2013-04-11T09:13:41Z")

</div>

ansible-playbook --help  
There is no -w.

Then I try:  
$ sudo ansible-playbook main.yml -K -k -w  
[sudo] password for agilairedev:  
Usage: ansible-playbook playbook.yml  
ansible-playbook: error: no such option: -w

---

<div class="post-metadata">

**Author:** ![PhilEv](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@PhilEv](https://forum.ansible.com/u/PhilEv)\
**Post date:** [April 11, 2013, 11:13am UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/6 "2013-04-11T11:13:46Z")

</div>

it a double ‘v’ aka v followed by a v not a w

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 11, 2013, 2:09pm UTC](https://forum.ansible.com/t/playbook-cannot-find-out-the-variable-which-set-in-global-vars-file/12659/7 "2013-04-11T14:09:24Z")

</div>

Yeah, this variable is “inventory scope” and tasks are at a higher scope, it is fine if it does not show up in the name of the task, it is still usable in action lines, templates, and so on.
