1ANSIBLE-INVENTORY(1) System administration commands ANSIBLE-INVENTORY(1)
2
3
4
6 ansible-inventory - Show Ansible inventory information, by default it
7 uses the inventory script JSON format
8
10 usage: ansible-inventory [-h] [--version] [-v] [-i INVENTORY]
11 [--vault-id VAULT_IDS] [--ask-vault-password | --vault-pass‐
12 word-file VAULT_PASSWORD_FILES] [--playbook-dir BASEDIR] [-e EX‐
13 TRA_VARS] [--list] [--host HOST] [--graph] [-y] [--toml]
14 [--vars] [--export] [--output OUTPUT_FILE] [host|group]
15
17 used to display or dump the configured inventory as Ansible sees it
18
20 None
21
22 --ask-vault-password, --ask-vault-pass
23 ask for vault password
24
25 --export
26 When doing an --list, represent in a way that is optimized for ex‐
27 port,not as an accurate representation of how Ansible has processed
28 it
29
30 --graph
31 create inventory graph, if supplying pattern it must be a valid
32 group name
33
34 --host 'HOST'
35 Output specific host info, works as inventory script
36
37 --list
38 Output all hosts info, works as inventory script
39
40 --output 'OUTPUT_FILE'
41 When doing --list, send the inventory to a file instead of to the
42 screen
43
44 --playbook-dir 'BASEDIR'
45 Since this tool does not use playbooks, use this as a substitute
46 playbook directory. This sets the relative path for many features
47 including roles/ group_vars/ etc.
48
49 --toml
50 Use TOML format instead of default JSON, ignored for --graph
51
52 --vars
53 Add vars to graph display, ignored unless used with --graph
54
55 --vault-id
56 the vault identity to use
57
58 --vault-password-file, --vault-pass-file
59 vault password file
60
61 --version
62 show program's version number, config file location, configured mod‐
63 ule search path, module location, executable location and exit
64
65 -e, --extra-vars
66 set additional variables as key=value or YAML/JSON, if filename
67 prepend with @
68
69 -h, --help
70 show this help message and exit
71
72 -i, --inventory, --inventory-file
73 specify inventory host path or comma separated host list. --inven‐
74 tory-file is deprecated
75
76 -v, --verbose
77 Causes Ansible to print more debug messages. Adding multiple -v will
78 increase the verbosity, the builtin plugins currently evaluate up to
79 -vvvvvv. A reasonable level to start is -vvv, connection debugging
80 might require -vvvv.
81
82 -y, --yaml
83 Use YAML format instead of default JSON, ignored for --graph
84
86 host
87
88 The name of a host to match in the inventory, relevant when using
89 --list
90
91 group
92
93 The name of a group in the inventory, relevant when using --graph
94
96 Ansible stores the hosts it can potentially operate on in an inventory.
97 This can be an YAML file, ini-like file, a script, directory, list,
98 etc. For additional options, see the documentation on
99 https://docs.ansible.com/.
100
102 The following environment variables may be specified.
103
104 ANSIBLE_INVENTORY -- Override the default ansible inventory sources
105
106 ANSIBLE_CONFIG -- Specify override location for the ansible config file
107
108 Many more are available for most options in ansible.cfg
109
110 For a full list check https://docs.ansible.com/. or use the ansi‐
111 ble-config command.
112
114 /etc/ansible/hosts -- Default inventory file
115
116 /etc/ansible/ansible.cfg -- Config file, used if present
117
118 ~/.ansible.cfg -- User config file, overrides the default config if
119 present
120
121 ./ansible.cfg -- Local config file (in current working directory) as‐
122 sumed to be 'project specific' and overrides the rest if present.
123
124 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
125 ride all others.
126
128 Ansible was originally written by Michael DeHaan.
129
131 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
132 terms of the GPLv3 license.
133
135 ansible (1), ansible-config (1), ansible-console (1), ansible-doc [22m(1),
136 ansible-galaxy [22m(1), ansible-playbook [22m(1), ansible-pull [22m(1), ansi‐
137 ble-vault (1)
138
139 Extensive documentation is available in the documentation site: <‐
140 https://docs.ansible.com>. IRC and mailing list info can be found in
141 file CONTRIBUTING.md, available in: <‐
142 https://github.com/ansible/ansible>
143
144
145
146
147Ansible 2.14.11 ANSIBLE-INVENTORY(1)