From the course: Red Hat Certified Engineer (EX294) Cert Prep: 1 Foundations of Ansible

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Show Ansible inventory

Show Ansible inventory

From the course: Red Hat Certified Engineer (EX294) Cert Prep: 1 Foundations of Ansible

Start my 1-month free trial

Show Ansible inventory

- [Instructor] If we have a simple setup it's very easy to count the /etc/ansible/host file to get a list of our inventory. However, as your system grows, this will no longer be a good option. Imagine hundreds of overlapping groups and thousands of managed hosts. The Ansible inventory command can help. Let's start by displaying a list of our inventory. To do so we'll use the Ansible-inventory command with a --list option. In a terminal type in ansible-inventory space --list and hit enter. Here we can see a JSON file listing all hosts, both of our Ansible groups named dbservers and webservers and the ungrouped group. If you want information on one specific host you can use the --host argument. However, as you can see from our rhost2.localnet.com managed host, there's not much to show. If you want to send the output to a file you can add the --output option for instance. Bring your line back and append --output space…

Contents