Debian Codegraph @

docs/cli/get-inventory-information.md

raw symbols SCIP
1 ---
2 title: Retrieving Inventory Information
3 hide:
4 - tags
5 tags:
6 - CLI
7 - Inventory
8 ---
9
10 <!--
11 ~ Copyright (c) 2023-2026 Arista Networks, Inc.
12 ~ Use of this source code is governed by the Apache License 2.0
13 ~ that can be found in the LICENSE file.
14 -->
15
16 The ANTA CLI offers multiple commands to access data from your local inventory.
17
18 ## List devices in inventory
19
20 This command will list all devices available in the inventory. Using the `--tags` option, you can filter this list to only include devices with specific tags (visit [this page](tag-management.md) to learn more about tags). The `--connected` option allows you to display only the devices where a connection has been established.
21
22 ### Command overview
23
24 ```bash
25 --8<-- "anta_get_inventory_help.txt"
26 ```
27
28 !!! tip
29 By default, `anta get inventory` only provides information that doesn't rely on a device connection. If you are interested in obtaining connection-dependent details, like the hardware model, use the `--connected` option.
30
31 ### Example
32
33 Let's consider the following inventory:
34
35 ```yaml
36 ---
37 anta_inventory:
38 hosts:
39 - host: 172.20.20.101
40 name: DC1-SPINE1
41 tags: ["SPINE", "DC1"]
42
43 - host: 172.20.20.102
44 name: DC1-SPINE2
45 tags: ["SPINE", "DC1"]
46
47 - host: 172.20.20.111
48 name: DC1-LEAF1A
49 tags: ["LEAF", "DC1"]
50
51 - host: 172.20.20.112
52 name: DC1-LEAF1B
53 tags: ["LEAF", "DC1"]
54
55 - host: 172.20.20.121
56 name: DC1-BL1
57 tags: ["BL", "DC1"]
58
59 - host: 172.20.20.122
60 name: DC1-BL2
61 tags: ["BL", "DC1"]
62
63 - host: 172.20.20.201
64 name: DC2-SPINE1
65 tags: ["SPINE", "DC2"]
66
67 - host: 172.20.20.202
68 name: DC2-SPINE2
69 tags: ["SPINE", "DC2"]
70
71 - host: 172.20.20.211
72 name: DC2-LEAF1A
73 tags: ["LEAF", "DC2"]
74
75 - host: 172.20.20.212
76 name: DC2-LEAF1B
77 tags: ["LEAF", "DC2"]
78
79 - host: 172.20.20.221
80 name: DC2-BL1
81 tags: ["BL", "DC2"]
82
83 - host: 172.20.20.222
84 name: DC2-BL2
85 tags: ["BL", "DC2"]
86 ```
87
88 To retrieve a comprehensive list of all devices along with their details, execute the following command. It will provide all the data loaded into the ANTA inventory from your [inventory file](../usage-inventory-catalog.md).
89
90 ```bash
91 $ anta get inventory --tags SPINE
92 Current inventory content is:
93 {
94 'DC1-SPINE1': AsyncEOSDevice(
95 name='DC1-SPINE1',
96 tags={'DC1-SPINE1', 'DC1', 'SPINE'},
97 hw_model=None,
98 is_online=False,
99 established=False,
100 disable_cache=False,
101 host='172.20.20.101',
102 eapi_port=443,
103 username='arista',
104 enable=False,
105 insecure=False
106 ),
107 'DC1-SPINE2': AsyncEOSDevice(
108 name='DC1-SPINE2',
109 tags={'DC1', 'SPINE', 'DC1-SPINE2'},
110 hw_model=None,
111 is_online=False,
112 established=False,
113 disable_cache=False,
114 host='172.20.20.102',
115 eapi_port=443,
116 username='arista',
117 enable=False,
118 insecure=False
119 ),
120 'DC2-SPINE1': AsyncEOSDevice(
121 name='DC2-SPINE1',
122 tags={'DC2', 'DC2-SPINE1', 'SPINE'},
123 hw_model=None,
124 is_online=False,
125 established=False,
126 disable_cache=False,
127 host='172.20.20.201',
128 eapi_port=443,
129 username='arista',
130 enable=False,
131 insecure=False
132 ),
133 'DC2-SPINE2': AsyncEOSDevice(
134 name='DC2-SPINE2',
135 tags={'DC2', 'DC2-SPINE2', 'SPINE'},
136 hw_model=None,
137 is_online=False,
138 established=False,
139 disable_cache=False,
140 host='172.20.20.202',
141 eapi_port=443,
142 username='arista',
143 enable=False,
144 insecure=False
145 )
146 }
147 ```