What are Ansible facts?

Ansible facts are pieces of information that Ansible automatically collects about the managed hosts during playbook execution. These facts provide details about the system's configuration, hardware, network interfaces, operating system, and more.

Some common examples of facts include:

  • ansible_hostname: The name of the host.
  • ansible_os_family: The family of the operating system (e.g., RedHat, Debian).
  • ansible_distribution: The name of the operating system distribution (e.g., Ubuntu, CentOS).
  • ansible_memory_mb: The amount of memory in megabytes.

You can access these facts in your playbooks to make decisions based on the system's characteristics. To gather facts, you can use the setup module, which collects and returns all available facts about the target host.

If you're looking to explore more about Ansible facts, consider checking out relevant labs on LabEx!

0 Comments

no data
Be the first to share your comment!