fact

A variable Ansible discovers about a host itself, such as its operating system, host name, memory or network addresses.

In more detail

Facts are collected by the setup module, usually automatically at the start of a play, and live under the ansible_facts variable, for example ansible_facts.os_family. Each host gets values describing itself, which lets one play adapt to different kinds of target. A fact can be missing or differ between operating systems, so test the values you depend on.

Example

{{ ansible_facts.hostname }}

Related terms

Taught in

References

Certification courses