- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# ce_snmp_target_host – Manages SNMP target host configuration on HUAWEI CloudEngine switches

New in version 2.4.

- Synopsis

- Parameters

- Notes

- Examples

- Return Values

- Status

## Synopsis

- Manages SNMP target host configurations on HUAWEI CloudEngine switches.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
address - |  | Network Address.
connect_port - |  | Udp port used by SNMP agent to connect the Network management.
host_name - |  | Unique name to identify target host entry.
interface_name - |  | Name of the interface to send the trap message.
is_public_net - | Choices: no_use ← true false | To enable or disable Public Net-manager for target Host.
notify_type - | Choices: trap inform | To configure notify type as trap or inform.
recv_port - |  | UDP Port number used by network management to receive alarm messages.
security_level - | Choices: noAuthNoPriv authentication privacy | Security level indicating whether to use authentication and encryption.
security_model - | Choices: v1 v2c v3 | Security Model.
security_name - |  | Security Name.
security_name_v3 - |  | Security Name V3.
version - | Choices: none v1 v2c v3 v1v2c v1v3 v2cv3 all | Version(s) Supported by SNMP Engine.
vpn_name - |  | VPN instance Name.

## Notes

Note

- This module requires the netconf system service be enabled on the remote device being managed.

- Recommended connection is `netconf`.

- This module also works with `local` connections for legacy playbooks.

## Examples

    - name: CloudEngine snmp target host test
      hosts: cloudengine
      connection: local
      gather_facts: no
      vars:
        cli:
          host: "{{ inventory_hostname }}"
          port: "{{ ansible_ssh_port }}"
          username: "{{ username }}"
          password: "{{ password }}"
          transport: cli

      tasks:

      - name: "Config SNMP version"
        ce_snmp_target_host:
          state: present
          version: v2cv3
          provider: "{{ cli }}"

      - name: "Config SNMP target host"
        ce_snmp_target_host:
          state: present
          host_name: test1
          address: 1.1.1.1
          notify_type: trap
          vpn_name: js
          security_model: v2c
          security_name: wdz
          provider: "{{ cli }}"

## Return Values

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

Key | Returned | Description
--- | --- | ---
changed boolean | always | check to see if a change was made on the device Sample: True
end_state dictionary | always | k/v pairs of aaa params after module execution Sample: {'target host info': [{'address': '10.135.182.158', 'domain': 'snmpUDPDomain', 'nmsName': 'test2', 'notifyType': 'trap', 'securityLevel': 'authentication', 'securityModel': 'v3', 'securityNameV3': 'wdz', 'vpnInstanceName': 'js'}]}
existing dictionary | always | k/v pairs of existing aaa server
proposed dictionary | always | k/v pairs of parameters passed into module Sample: {'address': '10.135.182.158', 'host_name': 'test2', 'notify_type': 'trap', 'security_level': 'authentication', 'security_model': 'v3', 'security_name_v3': 'wdz', 'state': 'present', 'vpn_name': 'js'}
updates list | always | command sent to the device Sample: ['snmp-agent target-host host-name test2 trap address udp-domain 10.135.182.158 vpn-instance js params securityname wdz v3 authentication']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Community. [community]

### Authors

- wangdezhuang (@QijunPan)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.