Listing hosts
When the --list argument is passed to an inventory script, Ansible expects the JSON output data to have a set of top-level keys. These keys are named for the groups in the inventory. Each group gets its own key. The structure within a group key varies depending on what data needs to be represented in the group. If a group just has hosts and no group-level variables, the data within the key can simply be a list of host names. If the group has variables or children (a group of groups), then the data needs to be a hash, which can have one or more keys named hosts, vars, or children. The hosts and children subkeys have a list value, a list of the hosts that exist in the group, or a list of the child groups. The vars subkey has a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access