Ansible – Dump all variables

Published on Author gryzli1 Comment

Sometimes you need all ansible variables for a debugging purpose or just to choose some from it.

This is explanation how to make a nice dump of the variables to a file residing on the remote host. If you want to print multiple/all variables in a more convenient way by seeing them directly on the console, you might be interested in this: Ansible Debug Print All Variables

Here is an easy way to do this:

1. Add the DUMP task in your main.yml

2. Create the template file “dumpall.j2” with the following content


3. Finally you can check all dumped variables in /tmp/ansible.all (the file must be created on the remote  host where you execute the task)

One Response to Ansible – Dump all variables

    FYI: this github project shows you how to list 90% of variables across all hosts. I find it more globally useful than single host commands. The README includes instructions for building a simple inventory report. It’s even more valuable to run this at the end of a playbook to see all the Facts. To also debug Task behaviour use register:

    The result is missing a few items: – included YAML file variables – extra-vars – a number of the Ansible internal vars described here: Ansible Behavioural Params

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.