LOGBOOK

HELP

Quiz Entry - updated: 2026.11.05

How can you see which facts Ansible gathers for a host?

Run a short play that gathers facts and prints the ansible_facts variable with debug. The output is one big JSON dictionary you can search for the values you need.

- name: Fact dump
  hosts: all
  tasks:
    - name: Print all facts
      ansible.builtin.debug:
        var: ansible_facts

A quicker alternative for one host, without writing a playbook, is the ad-hoc command ansible demo1.example.com -m ansible.builtin.setup. It runs the same module and prints the same data. Add a filter to narrow it: -a 'filter=ansible_default_ipv4'.

Expect a long output: hundreds of lines covering every interface, mount point and device. The point is to browse it once, find the key you need (default_ipv4, distribution, memtotal_mb, …), and then use exactly that key in your play.

Go deeper:

From Quiz: ITIA / Ansible Variables, Secrets and Facts | Updated: Nov 05, 2026