huawei.enterprise.hw_enterprise_snmp module – SNMP operations for Huawei Enterprise Storage

Note

This module is part of the huawei.enterprise collection (version 2.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install huawei.enterprise. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: huawei.enterprise.hw_enterprise_snmp.

Synopsis

  • Supports the provisioning operations on a SNMP such as modify and get the details of a SNMP.

Requirements

The below requirements are needed on the host that executes this module.

  • Huawei Dorado v5/v6/v7 and OceanStor v5/v6/v7 Storage

Parameters

Parameter

Comments

cmo_snmp_rd_community

string

Read-only community string that is used for reading device information.

cmo_snmp_rw_community

string

Read-write community string that is used for reading or writing device information.

custom_vars

dictionary

Parameters used to extend those not currently supported by the module.

Configuration needs to be based on the REST API documentation for storage.

If necessary, you can contact the plugin technical support for assistance.

filter

list / elements=string

Parameter required for all query operations.

The response will include the storage parameters that match the indicate filter criteria.

Choices:

  • "snmp_port"

  • "snmp_snmpv1v2c_status"

  • "snmp_address_ipv4"

  • "sys_root_oid"

  • "sys_desc"

  • "syss_objid"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

SNMP unique id.

password

string / required

The password of the PowerStore host.

snmp_port

string

Port, Optional parameters for modify operation.

The value is 161 or from 20000 to 20100.

snmp_snmpv1v2c_status

string

Sets the protocol switch status, Optional parameters for modify operation.

on choice must set SNMP community information before use

Choices:

  • "on"

  • "off"

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the SNMP should exist or not.

Choices:

  • "absent"

  • "present"

storage_port

integer

Port number for the Huawei Enterprise array.

If not passed, it will take 8088 as default.

Default: 8088

use_log

boolean

Whether to write plugin log to local filesystem.

Choices:

  • false ← (default)

  • true

username

string / required

The username of the PowerStore host.

valid_certs

string

The path of the SSL certificate variable to specify whether to validate SSL certificate or not.

If don’t set means no need to verify ssl cert.

Notes

Note

  • The check_mode is not supported.

  • The modules present in this collection named as ‘huawei.enterprise’ are built to support the Huawei Enterprise Storage System.

Examples

---
   tasks:
    - name: Set SNMP Community Information
      register: modify_snmp
      huawei.enterprise.hw_enterprise_snmp:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        operation: "set"
        cmo_snmp_rd_community: "{{ cmo_snmp_rd_community }}"
        cmo_snmp_wr_community: "{{ cmo_snmp_wr_community }}"
        state: "present"

    - name: Modify SNMP
      register: modify_snmp
      huawei.enterprise.hw_enterprise_snmp:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        snmp_snmpv1v2c_status: "< on | off >"
        snmp_port: "< snmp_port >"
        state: "present"

    - name: Query SNMP
      register: query_snmp
      huawei.enterprise.hw_enterprise_snmp:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        filter:
          - snmp_port
          - snmp_snmpv1v2c_status
          - snmp_address_ipv4
          - sys_root_oid
          - sys_desc
          - syss_objid
        state: "present"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

actions

list / elements=string

playbook action lists

Returned: always

Sample: ["query"]

changed

boolean

Whether or not the resource has changed.

Returned: always

Sample: false

remark

string

task execute remark

Returned: always

Sample: "Query snmp successfully"

snmp_detail

complex

Details of the SNMP.

Returned: When SNMP exists

Sample: {"snmp_address_ipv4": "xxx.xxx.xxx.xxx", "snmp_port": "xx", "snmp_snmpv1v2c_status": "on", "sys_desc": "ISM SNMP Agent", "sys_root_oid": "xx", "syss_objid": "xx"}

snmp_address_ipv4

string

IPv4 address.

Returned: always

snmp_port

string

Port.

Returned: always

snmp_snmpv1v2c_status

string

V1V2 switch status.

Returned: always

sys_desc

string

Default system description.

Returned: always

sys_root_oid

string

OID of the system root node.

Returned: always

syss_objid

string

System ID.

Returned: always

Authors

  • Huawei eSDK Ansible Team