snmp_facts - Retrieve facts for a device using SNMP.
New in version 1.9.
Synopsis
- Retrieve facts for a device using SNMP, the facts will be inserted to the ansible_facts key.
Requirements
The below requirements are needed on the host that executes this module.
- pysnmp
Parameters
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| authkey | Authentication key, required if version is v3 | |
| community | The SNMP community string, required if version is v2/v2c | |
| host required | Set to target snmp server (normally {{inventory_hostname}}) | |
| integrity |
| Hashing algorithm, required if version is v3 |
| level |
| Authentication level, required if version is v3 |
| privacy |
| Encryption algorithm, required if level is authPriv |
| privkey | Encryption key, required if version is authPriv | |
| username | Username for SNMPv3, required if version is v3 | |
| version required |
| SNMP Version to use, v2/v2c or v3 |
Examples
# Gather facts with SNMP version 2
- snmp_facts:
host: '{{ inventory_hostname }}'
version: v2c
community: public
delegate_to: local
# Gather facts using SNMP version 3
- snmp_facts:
host: '{{ inventory_hostname }}'
version: v3
level: authPriv
integrity: sha
privacy: aes
username: snmp-user
authkey: abc12345
privkey: def6789
delegate_to: localhost
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Author
- Patrick Ogenstad (@ogenstad)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/snmp_facts_module.html