community.network.cnos_logging (5.0.2) — module

Manage logging on network devices

Authors: Anil Kumar Muraleedharan (@amuraleedhar)

Install collection

Install with ansible-galaxy collection install community.network:==5.0.2


Add to requirements.yml

  collections:
    - name: community.network
      version: 5.0.2

Description

This module provides declarative management of logging on Cisco Cnos devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure server logging
  community.network.cnos_logging:
    dest: server
    name: 10.241.107.224
    facility: local7
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove server logging configuration
  community.network.cnos_logging:
    dest: server
    name: 10.241.107.224
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure console logging level and facility
  community.network.cnos_logging:
    dest: console
    level: 7
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure buffer size
  community.network.cnos_logging:
    dest: logfile
    level: 5
    name: testfile
    size: 5000
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging using aggregate
  community.network.cnos_logging:
    aggregate:
      - { dest: console, level: 6 }
      - { dest: logfile, size: 9000 }
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove logging using aggregate
  community.network.cnos_logging:
    aggregate:
      - { dest: console, level: 6 }
      - { dest: logfile, name: anil, size: 9000 }
    state: absent

Inputs

    
dest:
    choices:
    - server
    - console
    - monitor
    - logfile
    description:
    - Destination of the logs. Lenovo uses the term server instead of host in its CLI.

name:
    description:
    - If value of C(dest) is I(file) it indicates file-name and for I(server) indicates
      the server name to be notified.

size:
    default: 10485760
    description:
    - Size of buffer. The acceptable value is in range from 4096 to 4294967295 bytes.

level:
    default: 5
    description:
    - Set logging severity levels. 0-emerg;1-alert;2-crit;3-err;4-warn; 5-notif;6-inform;7-debug

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the logging configuration.

facility:
    description:
    - Set logging facility. This is applicable only for server logging

aggregate:
    description: List of logging definitions.

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - logging console 7
  - logging server 10.241.107.224
  type: list