Forrest logo
back to the ansible-inventory tool

ansible-inventory:tldr:f721f

ansible-inventory: Display the default inventory in YAML.
$ ansible-inventory --list --yaml
try on your machine

The command "ansible-inventory --list --yaml" is used to display the inventory of Ansible in YAML format. Here's a breakdown of each component of the command:

  1. "ansible-inventory": This is the command-line tool to manage and organize inventory in Ansible. It allows you to manipulate, query, and display information about your inventory.

  2. "--list": This option is used to request the inventory information in a readable format. It shows the complete inventory and its current state, including all groups, hosts, and their variables.

  3. "--yaml": This option specifies the output format as YAML. YAML (YAML Ain't Markup Language) is a human-readable data serialization format that is commonly used in configuration files. By specifying this option, the inventory information will be displayed in YAML format, which is easier to read and interpret.

When you execute the command "ansible-inventory --list --yaml," it will gather the inventory information, process it, and display it in a structured YAML format, providing detailed insights into your inventory's configuration and variables.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ansible-inventory tool