Home ansible
Post
Cancel

ansible

gather info

1
ansible localhost -m setup

debug

For debugging purposes it can be useful to not just dump hostvars but also all other variables and group information. You can do this using a jinja template which you could include in a debug task, like so:

1
2
3
4
tasks:
  - name: Dump all vars
    action: template src=templates/dumpall.j2 dest=/tmp/ansible.all

Then in dumpall.j2:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Module Variables ("vars"):
--------------------------------


Environment Variables ("environment"):
--------------------------------


GROUP NAMES Variables ("group_names"):
--------------------------------


GROUPS Variables ("groups"):
--------------------------------


HOST Variables ("hostvars"):
--------------------------------

All credit to Lester Wade

This post is licensed under CC BY 4.0 by the author.