Dump all Ansible hostvars for a host
If you want to dump all the hostvars for an Ansible host, try this:
ansible -i inventory -m command -a "echo \"{{ hostvars | to_nice_json }}\"" yourhost
You can also try out template filters, e.g. like so:
ansible -i inventory -m command -a "echo \"{{ hostvars | json_query('*.inventory_hostname') | to_nice_json }}\"" yourhost
Or display the host’s facts:
ansible -i inventory -m command -a "echo \"{{ vars | to_nice_json }}\"" yourhost