# Is there a list of all vars available in a template/playbook?

**URL:** <https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156>\
**Category:** Ansible Project\
**Created:** [December 21, 2012, 6:48pm UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156 "2012-12-21T18:48:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dylan\_Martin](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dylan\_Martin](https://forum.ansible.com/u/Dylan_Martin)\
**Post date:** [December 21, 2012, 6:48pm UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156/1 "2012-12-21T18:48:14Z")

</div>

I’m fumbling about and I keep running into vars I didn’t know existed. For example, I just saw “group\_names” in the hadoop iptables example ([https://github.com/jkleint/ansible-hadoop/blob/master/templates/iptables](https://github.com/jkleint/ansible-hadoop/blob/master/templates/iptables)).

I know I can make a template with {{ hostvarvs|pprint }} and see what hostvars I have. Then I found {{ groups|pprint }}. Now I just discovered {{ group\_names }}What joy! What other top-level variables are there that I should know about?

And what about in playbooks? I can register variables and use them, I can use ${hostvars.blah.blah.blah} and I can use the setup module to find ansible\_fact variables. Are there other vars available in playbooks by default? (not talking about vars I set in the playbook or vars\_files)

I’d love a canonical list or a command that outputs a list or a nudge in the direction of what part of the code I should examine.

Thanks for any answers and thanks for Ansible!  
-Dylan

---

<div class="post-metadata">

**Author:** ![Dylan\_Martin](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dylan\_Martin](https://forum.ansible.com/u/Dylan_Martin)\
**Post date:** [December 21, 2012, 7:07pm UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156/2 "2012-12-21T19:07:05Z")

</div>

As an aside, while poking around the docs I found this:

Also, in version 0.5 and later, Ansible playbook output is vastly upgraded if the cowsay package is installed. Try it!

Try it, I did. I am filled with conflicted emotions.

cowsay -T ‘||’ -e “/” “I vant to suck your miiiiilk”

---

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [December 22, 2012, 9:37am UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156/3 "2012-12-22T09:37:58Z")

</div>

> cowsay -T '||' -e "\/" "I vant to suck your miiiiilk"

After installing `cowsay' you can disable it for use by Ansible  
by setting ANSIBLE\_NOCOWS=moo in your environment. (\*ducks to avoid  
flying cows\*)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP

---

<div class="post-metadata">

**Author:** ![Benjamin\_Ritcey](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@Benjamin\_Ritcey](https://forum.ansible.com/u/Benjamin_Ritcey)\
**Post date:** [December 28, 2012, 4:06pm UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156/4 "2012-12-28T16:06:08Z")

</div>

I’ll add a ‘me too’ to this.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [December 28, 2012, 4:10pm UTC](https://forum.ansible.com/t/is-there-a-list-of-all-vars-available-in-a-template-playbook/12156/5 "2012-12-28T16:10:53Z")

</div>

Just dump a sample template and this will give you a very good idea.

Like this in a basic template:

{ hostvars["yourhostname"] | to\_yaml }
