Forrest logo
back to the ansible-inventory tool

ansible-inventory:tldr:a10ea

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

The command "ansible-inventory --list" is used to display the inventory data that Ansible uses in its operations. It retrieves and outputs the information about hosts and groups defined in the inventory files.

Here is a breakdown of the command:

  • "ansible-inventory" is the command-line tool provided by Ansible to manage inventory.
  • "--list" is an option that specifies the desired action to retrieve and display the inventory data in a JSON format.

When executed, this command will gather the inventory data from the default inventory file or any specified inventory file, and present it in a structured format. The information includes hosts and their associated attributes like IP addresses, port numbers, group membership, variables, and more.

By using the "--list" option, you can get an overview of the inventory setup, which can be helpful to verify the expected hosts, groups, and their configurations before running Ansible playbooks or commands.

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