dellemc.enterprise_sonic.sonic_logging (2.4.0) — module

Manage logging configuration on SONiC.

| "added in version" 2.1.0 of dellemc.enterprise_sonic"

Authors: M. Zhang (@mingjunzhang2019)

Install collection

Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0


Add to requirements.yml

  collections:
    - name: dellemc.enterprise_sonic
      version: 2.4.0

Description

This module provides configuration management of logging for devices running SONiC.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Using deleted
#
# Before state:
# -------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.0.2       5         Ethernet24          -              event
#10.11.1.1       616       Ethernet8           -              log
#log1.dell.com   6         Ethernet28          -              log
#
- name: Delete logging server configuration
  sonic_logging:
    config:
      remote_servers:
        - host: 10.11.0.2
        - host: log1.dell.com
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.1.1       616       Ethernet8           -              log
#
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.1.1       616       Ethernet8           -              log
#
- name: Merge logging server configuration
  sonic_logging:
    config:
      remote_servers:
        - host: 10.11.0.2
          remote_port: 5
          source_interface: Ethernet24
          message_type: event
        - host: log1.dell.com
          remote_port: 6
          source_interface: Ethernet28
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.0.2       5         Ethernet24          -              event
#10.11.1.1       616       Ethernet8           -              log
#log1.dell.com   6         Ethernet28          -              log
#
#
# Using overridden
#
# Before state:
# -------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.1.1       616       Ethernet8           -              log
#10.11.1.2       626       Ethernet16          -              event
#
- name: Replace logging server configuration
  sonic_logging:
    config:
      remote_servers:
        - host: 10.11.1.2
          remote_port: 622
          source_interface: Ethernet24
          message_type: event
    state: overridden
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
# ------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.1.2       622       Ethernet24          -              event
#
# Using replaced
#
# Before state:
# -------------
#
#sonic# show logging servers
#--------------------------------------------------------------------------------
#HOST            PORT      SOURCE-INTERFACE    VRF            MESSGE-TYPE
#--------------------------------------------------------------------------------
#10.11.1.1       616       Ethernet8           -              log
#10.11.1.2       626       Ethernet16          -              event
#
- name: Replace logging server configuration
  sonic_logging:
    config:
      remote_servers:
        - host: 10.11.1.2
          remote_port: 622
    state: replaced

Inputs

    
state:
    choices:
    - merged
    - replaced
    - overridden
    - deleted
    default: merged
    description:
    - The state of the configuration after module completion.
    type: str

config:
    description:
    - Specifies logging related configurations.
    suboptions:
      remote_servers:
        description:
        - Remote logging sever configuration.
        elements: dict
        suboptions:
          host:
            description:
            - IPv4/IPv6 address or host name of the remote logging server.
            required: true
            type: str
          message_type:
            choices:
            - log
            - event
            description:
            - Type of messages that remote server receives.
            - message_type can not be deleted.
            type: str
          remote_port:
            description:
            - Destination port number for logging messages sent to the server.
            - remote_port can not be deleted.
            type: int
          source_interface:
            description:
            - Source interface used as source ip for sending logging packets.
            - source_interface can not be deleted.
            type: str
          vrf:
            description:
            - VRF name used by remote logging server.
            type: str
        type: list
    type: dict

Outputs

after:
  description: The resulting configuration model invocation.
  returned: when changed
  sample: "The configuration returned will always be in the same format\n of the parameters\
    \ above.\n"
  type: list
after(generated):
  description: The generated configuration model invocation.
  returned: when C(check_mode)
  sample: "The configuration returned will always be in the same format\n of the parameters\
    \ above.\n"
  type: list
before:
  description: The configuration prior to the model invocation.
  returned: always
  sample: "The configuration returned will always be in the same format\n of the parameters\
    \ above.\n"
  type: list
commands:
  description: The set of commands pushed to the remote device.
  returned: always
  sample:
  - command 1
  - command 2
  - command 3
  type: list