# listing all defined variables

**URL:** <https://forum.ansible.com/t/listing-all-defined-variables/13768>\
**Category:** Ansible Project\
**Created:** [October 25, 2013, 4:05pm UTC](https://forum.ansible.com/t/listing-all-defined-variables/13768 "2013-10-25T16:05:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Martin2](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@James\_Martin2](https://forum.ansible.com/u/James_Martin2)\
**Post date:** [October 25, 2013, 4:05pm UTC](https://forum.ansible.com/t/listing-all-defined-variables/13768/1 "2013-10-25T16:05:16Z")

</div>

Is there a way to list all defined variables during a playbook run?  
Something similar to:

pprint.pprint(locals()) in python?

I'd basically like to get a snapshot of all defined variables -- host  
vars, things set with -e, group\_vars/all , etc.

Thanks,

James

---

<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:** [October 25, 2013, 11:44pm UTC](https://forum.ansible.com/t/listing-all-defined-variables/13768/2 "2013-10-25T23:44:01Z")

</div>

Assuming 1.4

debug: var=hostvars[inventory\_hostname]

Should get you pretty far.

If not on 1.4, you would want to template that instead and read the template.
