The Ansible ansible.snmp
collection includes a variety of plugins for using SNMP on the control node to make SNMP connections to a device.
This collection has been tested against following Ansible versions: >=2.15.0.
For collections that support Ansible 2.9, please ensure you update your network_os
to use the
fully qualified collection name (for example, cisco.ios.ios
).
Plugins and modules within a collection may be tested with only specific Ansible versions.
A collection may contain metadata that identifies these versions.
PEP440 is the schema used to describe the versions of Ansible.
Name | Description |
---|---|
ansible.snmp.v1 | Make SNMP v1 connections to a device |
ansible.snmp.v2c | Make SNMP v2c connections to a device |
ansible.snmp.v3_usm | Make SNMP v3 user-based security model (USM) connections to a device. |
Name | Description |
---|---|
ansible.snmp.get | Perform an SNMP get against a remote device for one or more OIDs |
ansible.snmp.set | Perform an SNMP set against a remote device for one or more OIDs |
ansible.snmp.walk | Perform an SNMP walk against a remote device for one or more OIDs |
You can install the ansible.snmp
collection with the Ansible Galaxy CLI:
ansible-galaxy collection install ansible.snmp
You can also include it in a requirements.yml
file and install it with ansible-galaxy collection install -r requirements.yml
, using the format:
---
collections:
- name: ansible.snmp
You can call modules by their Fully Qualified Collection Namespace (FQCN), such as ansible.snmp.get
.
The most common use case for this collection is to retrieve operation state information from a device using SNMP get
or SNMP walk
The following example task gets the existing configuration on an SNMP-enabled device, using the FQCN:
---
- name: Retrieve several individual OIDs
ansible.snmp.get:
oids:
- oid: "SNMPv2-MIB::sysDescr.0"
- oid: "SNMPv2-MIB::sysDescr"
iid: "0"
numeric: false
long_names: True
NOTE: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated.
- Using collections in the Ansible documentation for more details.
This collection is intended for plugins that are not platform or discipline-specific. Simple plugin examples should be generic in nature. More complex examples can include real-world platform modules to demonstrate the utility of the plugin in a playbook.
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the ansible.utils collection repository. See Contributing to Ansible-maintained collections for complete details.
See the Ansible Community Guide for details on contributing to Ansible.
This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.
Release notes are available here For automated release announcements refer here.
For information on releasing, versioning and deprecation see the strategy document.
In general, major versions can contain breaking changes, while minor versions only contain new features (like new plugin addition) and bug fixes. The releases will be done on an as-needed basis when new features and/or bug fixes are done.
- Ansible Collection Overview
- Ansible User Guide
- Ansible Developer guide
- Ansible Community code of conduct
GNU General Public License v3.0 or later.
See LICENSE to see the full text.
sudo dnf install net-snmp net-snmp-libs net-snmp-utils net-snmp-python
or
- download https://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.1/net-snmp-5.9.1.tar.gz/download
- extract
tar -xvf net-snmp-5.9.1.tar.gz
- as root
sudo su -
- cd
cd net-snmp-5.9.1
- set the path to system python
- configure
./configure --with-python-modules --libdir=/usr/lib64 --enable-shared
- make
make
- install
sudo make install
- add the install path to ld
more /etc/ld.so.conf.d/netsnmp.conf
/usr/local/lib
- cd
python
- build
python setup.py build
- install
python setup.py install
orpython setup.py install --user
- confirm
python -c 'import netsnmp'
- It's installed in system python
sudo dnf install perl-Term-ReadLine-Gnu
snmpconf -p
- 1: snmp.conf
- 4: Textual mib parsing
- 1: Specifies directory to be searched for mibs
- Enter the list of directories to search through for mibs: +/home/ftp_site/cisco_mibs
- finished
- finished
- quit
- review
~/.snmp/snmp.conf
python3 -m venv venv --system-site-packages
or install again after sourcing venv
python3 -m venv venv
source venv/bin/activate
pip install net-snmp-5.9.1/python
- net-snmp bindings
- dump MIBs into other formats, including python classes libsmi
- Cisco MIB FTP details here
- SNMP table traversal here
As a Red Hat Ansible Certified Content, this collection is entitled to support through Ansible Automation Platform (AAP).
If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there is community support available at no charge.
You can join us on #network:ansible.com room or the Ansible Forum Network Working Group.
GNU General Public License v3.0 or later.
See LICENSE to see the full text.