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