Ansible variables come from a variety of sources. It is for example possible to provide host_vars and group_vars by creating YAML files in a subfolder named host_vars
and group_vars
respectively of the folder containing the inventory file.
How can I list all of the variables Ansible would know about a group or host inside a playbook? Note: I tried ansible -m debug -e 'var=hostvars' host
and ansible -m debug -e '- debug: var=hostvars'
to no avail.
Hint: ansible <group|host> -m setup
is not the correct answer as it does not include all the variables that come from other sources (it only contains { "ansible_facts" : { ... } }
. In fact it does not even include variables provided by a dynamic inventory script (via _meta
and so on).
Ansible version: 1.9.1.