Debian Codegraph @

ansible_collections/cisco/ios/docs/cisco.ios.ios_facts_module.rst

raw
1 .. _cisco.ios.ios_facts_module:
2
3
4 *******************
5 cisco.ios.ios_facts
6 *******************
7
8 **Module to collect facts from remote devices.**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - Collects a base set of device facts from a remote device that is running IOS. This module prepends all of the base network fact keys with ``ansible_net_<fact>``. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="1">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="1">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>available_network_resources</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">boolean</span>
43 </div>
44 </td>
45 <td>
46 <ul style="margin: 0; padding: 0"><b>Choices:</b>
47 <li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
48 <li>yes</li>
49 </ul>
50 </td>
51 <td>
52 <div>When &#x27;True&#x27; a list of network resources for which resource modules are available will be provided.</div>
53 </td>
54 </tr>
55 <tr>
56 <td colspan="1">
57 <div class="ansibleOptionAnchor" id="parameter-"></div>
58 <b>gather_network_resources</b>
59 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
60 <div style="font-size: small">
61 <span style="color: purple">list</span>
62 / <span style="color: purple">elements=string</span>
63 </div>
64 </td>
65 <td>
66 </td>
67 <td>
68 <div>When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all and the resources like interfaces, vlans etc. Can specify a list of values to include a larger subset. Values can also be used with an initial <code>!</code> to specify that a specific subset should not be collected. Valid subsets are &#x27;hsrp_interfaces&#x27;, &#x27;bgp_global&#x27;, &#x27;l3_interfaces&#x27;, &#x27;lag_interfaces&#x27;, &#x27;ntp_global&#x27;, &#x27;acls&#x27;, &#x27;hostname&#x27;, &#x27;interfaces&#x27;, &#x27;lldp_interfaces&#x27;, &#x27;logging_global&#x27;, &#x27;ospf_interfaces&#x27;, &#x27;ospfv2&#x27;, &#x27;prefix_lists&#x27;, &#x27;static_routes&#x27;, &#x27;acl_interfaces&#x27;, &#x27;all&#x27;, &#x27;bgp_address_family&#x27;, &#x27;l2_interfaces&#x27;, &#x27;lacp&#x27;, &#x27;lacp_interfaces&#x27;, &#x27;lldp_global&#x27;, &#x27;ospfv3&#x27;, &#x27;snmp_server&#x27;, &#x27;vlans&#x27;, &#x27;service&#x27;.</div>
69 </td>
70 </tr>
71 <tr>
72 <td colspan="1">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>gather_subset</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">list</span>
78 / <span style="color: purple">elements=string</span>
79 </div>
80 </td>
81 <td>
82 <b>Default:</b><br/><div style="color: blue">"min"</div>
83 </td>
84 <td>
85 <div>When supplied, this argument restricts the facts collected to a given subset.</div>
86 <div>Possible values for this argument include <code>all</code>, <code>min</code>, <code>default</code>, <code>hardware</code>, <code>config</code>, and <code>interfaces</code>.</div>
87 <div>Specify a list of values to include a larger subset.</div>
88 <div>Use a value with an initial <code>!</code> to collect all facts except that subset.</div>
89 </td>
90 </tr>
91 </table>
92 <br/>
93
94
95 Notes
96 -----
97
98 .. note::
99 - Tested against Cisco IOSXE Version 17.3 on CML and IOS 15.6 for L2 specific resource.
100 - Facts gathering for L3 devices are supposed to produce blank output for unsupported resources like vlan.
101 - This module works with connection ``network_cli``. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html
102 - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>`
103 - For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_.
104
105
106
107 Examples
108 --------
109
110 .. code-block:: yaml
111
112 - name: Gather all legacy facts
113 cisco.ios.ios_facts:
114 gather_subset: all
115
116 - name: Gather only the config and default facts
117 cisco.ios.ios_facts:
118 gather_subset:
119 - config
120
121 - name: Do not gather hardware facts
122 cisco.ios.ios_facts:
123 gather_subset:
124 - "!hardware"
125
126 - name: Gather legacy and resource facts
127 cisco.ios.ios_facts:
128 gather_subset: all
129 gather_network_resources: all
130
131 - name: Gather only the interfaces resource facts and no legacy facts
132 cisco.ios.ios_facts:
133 gather_subset:
134 - "!all"
135 - "!min"
136 gather_network_resources:
137 - interfaces
138
139 - name: Gather interfaces resource and minimal legacy facts
140 cisco.ios.ios_facts:
141 gather_subset: min
142 gather_network_resources: interfaces
143
144 - name: Gather L2 interfaces resource and minimal legacy facts
145 cisco.ios.ios_facts:
146 gather_subset: min
147 gather_network_resources: l2_interfaces
148
149 - name: Gather L3 interfaces resource and minimal legacy facts
150 cisco.ios.ios_facts:
151 gather_subset: min
152 gather_network_resources: l3_interfaces
153
154
155
156 Return Values
157 -------------
158 Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
159
160 .. raw:: html
161
162 <table border=0 cellpadding=0 class="documentation-table">
163 <tr>
164 <th colspan="1">Key</th>
165 <th>Returned</th>
166 <th width="100%">Description</th>
167 </tr>
168 <tr>
169 <td colspan="1">
170 <div class="ansibleOptionAnchor" id="return-"></div>
171 <b>ansible_net_all_ipv4_addresses</b>
172 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
173 <div style="font-size: small">
174 <span style="color: purple">list</span>
175 </div>
176 </td>
177 <td>when interfaces is configured</td>
178 <td>
179 <div>All IPv4 addresses configured on the device</div>
180 <br/>
181 </td>
182 </tr>
183 <tr>
184 <td colspan="1">
185 <div class="ansibleOptionAnchor" id="return-"></div>
186 <b>ansible_net_all_ipv6_addresses</b>
187 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
188 <div style="font-size: small">
189 <span style="color: purple">list</span>
190 </div>
191 </td>
192 <td>when interfaces is configured</td>
193 <td>
194 <div>All IPv6 addresses configured on the device</div>
195 <br/>
196 </td>
197 </tr>
198 <tr>
199 <td colspan="1">
200 <div class="ansibleOptionAnchor" id="return-"></div>
201 <b>ansible_net_api</b>
202 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
203 <div style="font-size: small">
204 <span style="color: purple">string</span>
205 </div>
206 </td>
207 <td>always</td>
208 <td>
209 <div>The name of the transport</div>
210 <br/>
211 </td>
212 </tr>
213 <tr>
214 <td colspan="1">
215 <div class="ansibleOptionAnchor" id="return-"></div>
216 <b>ansible_net_config</b>
217 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
218 <div style="font-size: small">
219 <span style="color: purple">string</span>
220 </div>
221 </td>
222 <td>when config is configured</td>
223 <td>
224 <div>The current active config from the device</div>
225 <br/>
226 </td>
227 </tr>
228 <tr>
229 <td colspan="1">
230 <div class="ansibleOptionAnchor" id="return-"></div>
231 <b>ansible_net_cpu_utilization</b>
232 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
233 <div style="font-size: small">
234 <span style="color: purple">dictionary</span>
235 </div>
236 </td>
237 <td>when hardware is configured</td>
238 <td>
239 <div>The current CPU utilization of the device</div>
240 <br/>
241 </td>
242 </tr>
243 <tr>
244 <td colspan="1">
245 <div class="ansibleOptionAnchor" id="return-"></div>
246 <b>ansible_net_filesystems</b>
247 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
248 <div style="font-size: small">
249 <span style="color: purple">list</span>
250 </div>
251 </td>
252 <td>when hardware is configured</td>
253 <td>
254 <div>All file system names available on the device</div>
255 <br/>
256 </td>
257 </tr>
258 <tr>
259 <td colspan="1">
260 <div class="ansibleOptionAnchor" id="return-"></div>
261 <b>ansible_net_filesystems_info</b>
262 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
263 <div style="font-size: small">
264 <span style="color: purple">dictionary</span>
265 </div>
266 </td>
267 <td>when hardware is configured</td>
268 <td>
269 <div>A hash of all file systems containing info about each file system (e.g. free and total space)</div>
270 <br/>
271 </td>
272 </tr>
273 <tr>
274 <td colspan="1">
275 <div class="ansibleOptionAnchor" id="return-"></div>
276 <b>ansible_net_gather_network_resources</b>
277 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
278 <div style="font-size: small">
279 <span style="color: purple">list</span>
280 </div>
281 </td>
282 <td>when the resource is configured</td>
283 <td>
284 <div>The list of fact for network resource subsets collected from the device</div>
285 <br/>
286 </td>
287 </tr>
288 <tr>
289 <td colspan="1">
290 <div class="ansibleOptionAnchor" id="return-"></div>
291 <b>ansible_net_gather_subset</b>
292 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
293 <div style="font-size: small">
294 <span style="color: purple">list</span>
295 </div>
296 </td>
297 <td>always</td>
298 <td>
299 <div>The list of fact subsets collected from the device</div>
300 <br/>
301 </td>
302 </tr>
303 <tr>
304 <td colspan="1">
305 <div class="ansibleOptionAnchor" id="return-"></div>
306 <b>ansible_net_hostname</b>
307 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
308 <div style="font-size: small">
309 <span style="color: purple">string</span>
310 </div>
311 </td>
312 <td>always</td>
313 <td>
314 <div>The configured hostname of the device</div>
315 <br/>
316 </td>
317 </tr>
318 <tr>
319 <td colspan="1">
320 <div class="ansibleOptionAnchor" id="return-"></div>
321 <b>ansible_net_image</b>
322 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
323 <div style="font-size: small">
324 <span style="color: purple">string</span>
325 </div>
326 </td>
327 <td>always</td>
328 <td>
329 <div>The image file the device is running</div>
330 <br/>
331 </td>
332 </tr>
333 <tr>
334 <td colspan="1">
335 <div class="ansibleOptionAnchor" id="return-"></div>
336 <b>ansible_net_interfaces</b>
337 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
338 <div style="font-size: small">
339 <span style="color: purple">dictionary</span>
340 </div>
341 </td>
342 <td>when interfaces is configured</td>
343 <td>
344 <div>A hash of all interfaces running on the system</div>
345 <br/>
346 </td>
347 </tr>
348 <tr>
349 <td colspan="1">
350 <div class="ansibleOptionAnchor" id="return-"></div>
351 <b>ansible_net_iostype</b>
352 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
353 <div style="font-size: small">
354 <span style="color: purple">string</span>
355 </div>
356 </td>
357 <td>always</td>
358 <td>
359 <div>The operating system type (IOS or IOS-XE) running on the remote device</div>
360 <br/>
361 </td>
362 </tr>
363 <tr>
364 <td colspan="1">
365 <div class="ansibleOptionAnchor" id="return-"></div>
366 <b>ansible_net_memfree_mb</b>
367 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
368 <div style="font-size: small">
369 <span style="color: purple">integer</span>
370 </div>
371 </td>
372 <td>when hardware is configured</td>
373 <td>
374 <div>The available free memory on the remote device in MiB</div>
375 <br/>
376 </td>
377 </tr>
378 <tr>
379 <td colspan="1">
380 <div class="ansibleOptionAnchor" id="return-"></div>
381 <b>ansible_net_memtotal_mb</b>
382 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
383 <div style="font-size: small">
384 <span style="color: purple">integer</span>
385 </div>
386 </td>
387 <td>when hardware is configured</td>
388 <td>
389 <div>The total memory on the remote device in MiB</div>
390 <br/>
391 </td>
392 </tr>
393 <tr>
394 <td colspan="1">
395 <div class="ansibleOptionAnchor" id="return-"></div>
396 <b>ansible_net_model</b>
397 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
398 <div style="font-size: small">
399 <span style="color: purple">string</span>
400 </div>
401 </td>
402 <td>always</td>
403 <td>
404 <div>The model name returned from the device</div>
405 <br/>
406 </td>
407 </tr>
408 <tr>
409 <td colspan="1">
410 <div class="ansibleOptionAnchor" id="return-"></div>
411 <b>ansible_net_neighbors</b>
412 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
413 <div style="font-size: small">
414 <span style="color: purple">dictionary</span>
415 </div>
416 </td>
417 <td>when interfaces is configured</td>
418 <td>
419 <div>The list of CDP and LLDP neighbors from the remote device. If both, CDP and LLDP neighbor data is present on one port, CDP is preferred.</div>
420 <br/>
421 </td>
422 </tr>
423 <tr>
424 <td colspan="1">
425 <div class="ansibleOptionAnchor" id="return-"></div>
426 <b>ansible_net_python_version</b>
427 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
428 <div style="font-size: small">
429 <span style="color: purple">string</span>
430 </div>
431 </td>
432 <td>always</td>
433 <td>
434 <div>The Python version Ansible controller is using</div>
435 <br/>
436 </td>
437 </tr>
438 <tr>
439 <td colspan="1">
440 <div class="ansibleOptionAnchor" id="return-"></div>
441 <b>ansible_net_serialnum</b>
442 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
443 <div style="font-size: small">
444 <span style="color: purple">string</span>
445 </div>
446 </td>
447 <td>always</td>
448 <td>
449 <div>The serial number of the remote device</div>
450 <br/>
451 </td>
452 </tr>
453 <tr>
454 <td colspan="1">
455 <div class="ansibleOptionAnchor" id="return-"></div>
456 <b>ansible_net_stacked_models</b>
457 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
458 <div style="font-size: small">
459 <span style="color: purple">list</span>
460 </div>
461 </td>
462 <td>when multiple devices are configured in a stack</td>
463 <td>
464 <div>The model names of each device in the stack</div>
465 <br/>
466 </td>
467 </tr>
468 <tr>
469 <td colspan="1">
470 <div class="ansibleOptionAnchor" id="return-"></div>
471 <b>ansible_net_stacked_serialnums</b>
472 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
473 <div style="font-size: small">
474 <span style="color: purple">list</span>
475 </div>
476 </td>
477 <td>when multiple devices are configured in a stack</td>
478 <td>
479 <div>The serial numbers of each device in the stack</div>
480 <br/>
481 </td>
482 </tr>
483 <tr>
484 <td colspan="1">
485 <div class="ansibleOptionAnchor" id="return-"></div>
486 <b>ansible_net_version</b>
487 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
488 <div style="font-size: small">
489 <span style="color: purple">string</span>
490 </div>
491 </td>
492 <td>always</td>
493 <td>
494 <div>The operating system version running on the remote device</div>
495 <br/>
496 </td>
497 </tr>
498 </table>
499 <br/><br/>
500
501
502 Status
503 ------
504
505
506 Authors
507 ~~~~~~~
508
509 - Peter Sprygada (@privateip)
510 - Sumit Jaiswal (@justjais)