huawei.enterprise.hw_enterprise_snmp_trap module – SNMP Trap 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_trap.
Synopsis
Supports the provisioning operations on a SNMP Trap such as modify and get the details of a SNMP Trap.
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 |
|---|---|
Trap server address. The value can be a domain name or an IPv4 or IPv6 address. |
|
Trap server port. 1 to 65535. |
|
Trap server type. The value is 161 or from 20000 to 20100. Choices:
|
|
USM username. |
|
Trap version Choices:
|
|
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. |
|
Parameter required for all query operations. The response will include the storage parameters that match the indicate filter criteria. Choices:
|
|
IP or FQDN of the huawei enterprise management system. MultiIP config as ip1,ip2 |
|
SNMP Trap unique id. |
|
The password of the PowerStore host. |
|
Huawei Enterprise Storage rest api Timeout time. Default: |
|
Define whether the SNMP Trap should exist or not. Choices:
|
|
Port number for the Huawei Enterprise array. If not passed, it will take 8088 as default. Default: |
|
Whether to write plugin log to local filesystem. Choices:
|
|
The username of the PowerStore host. |
|
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: Add SNMP trap Service
register: snmp_trap_info
huawei.enterprise.hw_enterprise_snmp_trap:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
valid_certs: "{{ valid_certs }}"
socket_timeout: "{{ socket_timeout }}"
storage_port: "{{ storage_port }}"
use_log: "{{ use_log }}"
cmo_trap_server_ip: "< cmo_trap_server_ip >"
cmo_trap_server_port: "< cmo_trap_server_port >"
cmo_trap_server_user: "< cmo_trap_server_user >"
cmo_trap_server_type: "< parsed | original | all | parsed_time_string | original_time_string >"
cmo_trap_version: "< SNMPv1 | SNMPv2c | SNMPv3 >"
state: "present"
- name: Modify SNMP Trap Service
register: snmp_trap_info
huawei.enterprise.hw_enterprise_snmp_trap:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
valid_certs: "{{ valid_certs }}"
socket_timeout: "{{ socket_timeout }}"
storage_port: "{{ storage_port }}"
use_log: "{{ use_log }}"
id: "{{ snmp_trap_info.snmp_trap_detail.id }}"
cmo_trap_server_ip: "< cmo_trap_server_ip >"
cmo_trap_server_port: "< cmo_trap_server_port >"
cmo_trap_server_user: "< cmo_trap_server_user >"
cmo_trap_server_type: "< parsed | original | all | parsed_time_string | original_time_string >"
cmo_trap_version: "< SNMPv1 | SNMPv2c | SNMPv3 >"
state: "present"
- name: Get All SNMP Trap Service
register: all_snmp_trap
huawei.enterprise.hw_enterprise_snmp_trap:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
valid_certs: "{{ valid_certs }}"
socket_timeout: "{{ socket_timeout }}"
storage_port: "{{ storage_port }}"
use_log: "{{ use_log }}"
state: "present"
filter:
- id
- cmo_trap_server_ip
- cmo_trap_server_port
- cmo_trap_server_user
- cmo_trap_server_type
- cmo_trap_version
- name: Get SNMP Trap By Id
register: snmp_trap_info
huawei.enterprise.hw_enterprise_snmp_trap:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
valid_certs: "{{ valid_certs }}"
socket_timeout: "{{ socket_timeout }}"
storage_port: "{{ storage_port }}"
use_log: "{{ use_log }}"
id: "{{ snmp_trap_info.snmp_trap_detail.id }}"
state: "present"
filter:
- id
- cmo_trap_server_ip
- cmo_trap_server_port
- cmo_trap_server_user
- cmo_trap_server_type
- cmo_trap_version
- name: Delete SNMP Trap Service
huawei.enterprise.hw_enterprise_snmp_trap:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
valid_certs: "{{ valid_certs }}"
socket_timeout: "{{ socket_timeout }}"
storage_port: "{{ storage_port }}"
use_log: "{{ use_log }}"
id: "{{ snmp_trap_info.snmp_trap_detail.id }}"
state: "absent"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
playbook action lists Returned: always Sample: |
|
Whether or not the resource has changed. Returned: always Sample: |
|
task execute remark Returned: always Sample: |
|
Details of the SNMP Trap. Returned: When SNMP Trap exists Sample: |
|
Trap server address. Returned: success |
|
Trap server port Returned: success |
|
Trap server type. Returned: success |
|
USM username. Returned: success |
|
Trap version. Returned: success |
|
SNMP Trap unique id. Returned: success |