LOGBOOK

HELP

Quiz Entry - updated: 2026.11.05

Which commonly used facts hold the short hostname, the FQDN, the main IPv4 address, the interface list, the DNS servers and the kernel version?

ansible_facts['hostname'], ansible_facts['fqdn'], ansible_facts['default_ipv4']['address'], ansible_facts['interfaces'], ansible_facts['dns']['nameservers'] and ansible_facts['kernel'].

Fact Variable
Short hostname ansible_facts['hostname']
Fully qualified domain name ansible_facts['fqdn']
Main IPv4 address (the interface on the default route) ansible_facts['default_ipv4']['address']
Names of all network interfaces (a list) ansible_facts['interfaces']
Size of the /dev/vda1 partition ansible_facts['devices']['vda']['partitions']['vda1']['size']
DNS servers (a list) ansible_facts['dns']['nameservers']
Running kernel version ansible_facts['kernel']

Several of these are nested dictionaries, so you go down one key at a time: default_ipv4 is itself a dictionary with address, interface, gateway and more. As with any dictionary, dot notation works too: ansible_facts.default_ipv4.address.

"Main" IPv4 address means the address on the interface Linux would use to reach the default gateway. A host with several interfaces has several addresses, and this fact picks the one used for outgoing traffic.

Go deeper:

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