ansible-inventory(1)
π ansible-inventory(1) β the girlies' guide to peeking at your inventory
okay so bestie, welcome to ansible-inventory, part of the system administration commands squad. this little icon shows you Ansible inventory information, and by default it gives you the inventory script JSON format. no cap, it's giving "let me see what Ansible actually thinks you configured" β¨
β¨ SYNOPSIS β¨
usage: ansible-inventory [-h] [--version] [-v] [-i INVENTORY] [-l SUBSET]
[--flush-cache] [--vault-id VAULT_IDS] [-J |
--vault-password-file VAULT_PASSWORD_FILES] [--playbook-dir BASEDIR]
[-e EXTRA_VARS] [--list] [--host HOST] [--graph] [-y] [--toml] [--vars]
[--export] [--output OUTPUT_FILE] [group]
π¦ DESCRIPTION π¦
it's literally used to display or dump the configured inventory exactly as Ansible sees it. that's the whole vibe. π«Ά
π COMMON OPTIONS π
groupβ the name of a group in the inventory, relevant when using--graph. she's the positional argument, she's main character energy π--exportβ when you're doing--list, represent the inventory in a way that's optimized for export, not as an accurate representation of how Ansible has actually processed it. so like, pretty for shipping, not for truth-telling π--flush-cacheβ clear the fact cache for every host in inventory. bye bye cached facts π--graphβ create an inventory graph! if you're supplying a pattern it must be a valid group name. it will ignorelimit. periodt.--host'HOST' β output specific host info, works as an inventory script. it will ignorelimit. very "just this one host bestie" π--listβ output all hosts info, works as an inventory script. the full cast list π--output'OUTPUT_FILE' β when you're doing--list, send the inventory to a file instead of to the screen. lowkey tidy of you π--playbook-dir'BASEDIR' β since this tool does not use playbooks, use this as a substitute playbook directory. this sets the relative path for many features includingroles/,group_vars/, etc. it's giving "pretend playbook lives here" π§--tomlβ use TOML format instead of the default JSON. ignored for--graph. she only shows up when she's invited β¨--varsβ add vars to the graph display, ignored unless used with--graph. no graph, no vars, that's the rule π--vault-idβ the vault identity to use. this argument may be specified multiple times. stack 'em π--vault-password-file,--vault-pass-fileβ vault password file. that's it, that's the tweet π--versionβ show program's version number, config file location, configured module search path, module location, executable location, and then exit. the full selfie dump πΈ-J,--ask-vault-password,--ask-vault-passβ ask for the vault password. she will prompt you, bestie π-e,--extra-varsβ set additional variables askey=valueor YAML/JSON, and if it's a filename, prepend with@. this argument may be specified multiple times. go off, add all the vars π₯-h,--helpβ show this help message and exit. the classic escape hatch π-i,--inventory,--inventory-fileβ specify inventory host path or comma separated host list. this argument may be specified multiple times. yup, multiple times, she said what she said π-l'SUBSET',--limit'SUBSET' β further limit selected hosts to an additional pattern. narrowing it down, very selective of you β-v,--verboseβ causes Ansible to print more debug messages. adding multiple-vwill increase the verbosity, the builtin plugins currently evaluate up to-vvvvvv. a reasonable level to start is-vvv, connection debugging might require-vvvv. this argument may be specified multiple times. the way that-vjust keeps giving π-y,--yamlβ use YAML format instead of the default JSON. ignored for--graph. yaml girlies rise πΈ
π§ ARGUMENTS π§
group
the name of a group in the inventory, relevant when using --graph. yes, we said it twice, because the manpage said it twice and we don't gatekeep. π«
πΈ INVENTORY πΈ
Ansible stores the hosts it can potentially operate on in an inventory. this can be a YAML file, ini-like file, a script, directory, list, etc. β she's flexible like that π¦
for additional options, see the documentation on <https://docs.ansible.com/>.
π ENVIRONMENT π
the following environment variables may be specified:
ANSIBLE_INVENTORYβ override the default ansible inventory sources πANSIBLE_CONFIGβ specify an override location for the ansible config file β¨
many more are available for most options in ansible.cfg.
for a full list check <https://docs.ansible.com/>, or use the ansible-config command. iykyk π
π FILES π
/etc/ansible/hostsβ default inventory file/etc/ansible/ansible.cfgβ config file, used if present~/.ansible.cfgβ user config file, overrides the default config if present./ansible.cfgβ local config file (in current working directory), assumed to be 'project specific' and overrides the rest if present.
as mentioned above, the ANSIBLE_CONFIG environment variable will override all others. she's the final boss π
π AUTHOR π
Ansible was originally written by Michael DeHaan. legend behavior, honestly π«Ά
π₯ COPYRIGHT π₯
Copyright Β© 2018 Red Hat, Inc | Ansible. Ansible is released under the terms of the GPLv3 license.
β SEE ALSO β
ansible (1), ansible-config (1), ansible-console (1), ansible-doc (1), ansible-galaxy (1), ansible-playbook (1), ansible-pull (1), ansible-vault (1)
extensive documentation is available in the documentation site: <<https://docs.ansible.com>>. IRC and mailing list info can be found in file CONTRIBUTING.md, available in: <<https://github.com/ansible/ansible>>
okay that's the whole page bestie, no notes π this was Ansible 2.22.0, ansible-inventory(1) β go forth and dump that inventory, you absolute icon πβ¨
π¦ where this page comes from
- arch rolling: ansible-core 2.22.0-1 Β· GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms