Search⌘ K
AI Features

Magic Variables

Explore Ansible magic variables to access detailed host information and properties without needing gather_facts enabled. Understand key magic variables like hostvars and ansible_version to enhance playbook efficiency and automate complex IT tasks.

Magic variables in Ansible contain information about the target hosts and can be useful in certain situations. It’s important to note that magic variables are internal variables within Ansible. They should not be confused with Ansible facts. The main distinction between them is that magic variables do not require enabling gather_facts at the beginning of an Ansible playbook, unlike Ansible facts.

Common magic variables

Here are the ...