community.network.ce_info_center_log 模块 – 管理华为 CloudEngine 交换机上的信息中心日志配置。

注意

此模块是 community.network 集合 (版本 5.1.0) 的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.network

要在剧本中使用它,请指定: community.network.ce_info_center_log

注意

community.network 集合已被弃用,并将从 Ansible 12 中删除。有关更多信息,请参阅 讨论主题

已弃用

在以下版本中移除:

6.0.0 版本

原因:

此集合及其中的所有内容均未维护且已弃用。

替代方案:

未知。

概要

  • 设置日志的时间戳格式。配置设备将日志输出到日志缓冲区。

别名:network.cloudengine.ce_info_center_log

参数

参数

注释

channel_id

字符串

指定通道 ID。值是一个介于 0 到 9 之间的整数。

log_buff_enable

字符串

启用交换机将日志发送到日志缓冲区。

选项

  • "no_use" ← (默认)

  • "true"

  • "false"

log_buff_size

字符串

指定日志缓冲区中的最大日志数。值是一个介于 0 到 10240 之间的整数。如果 logbuffer-size 为 0,则不显示日志。

log_enable

字符串

指示是否启用了日志过滤。

选项

  • "no_use" ← (默认)

  • "true"

  • "false"

log_level

字符串

指定日志严重性。

选项

  • "emergencies"

  • "alert"

  • "critical"

  • "error"

  • "warning"

  • "notification"

  • "informational"

  • "debugging"

log_time_stamp

字符串

设置日志的时间戳格式。

选项

  • "date_boot"

  • "date_second"

  • "date_tenthsecond"

  • "date_millisecond"

  • "shortdate_second"

  • "shortdate_tenthsecond"

  • "shortdate_millisecond"

  • "formatdate_second"

  • "formatdate_tenthsecond"

  • "formatdate_millisecond"

module_name

字符串

指定模块的名称。值是注册日志中的模块名称。

state

字符串

确定配置是否应该存在于设备上。

选项

  • "present" ← (默认)

  • "absent"

备注

注意

  • 此模块要求在被管理的远程设备上启用 netconf 系统服务。

  • 推荐的连接方式是 netconf

  • 此模块也适用于旧版剧本的 local 连接。

示例

- name: CloudEngine info center log test
  hosts: cloudengine
  connection: local
  gather_facts: false
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli

  tasks:

  - name: "Setting the timestamp format of logs"
    community.network.ce_info_center_log:
      log_time_stamp: date_tenthsecond
      provider: "{{ cli }}"

  - name: "Enabled to output information to the log buffer"
    community.network.ce_info_center_log:
      log_buff_enable: true
      provider: "{{ cli }}"

  - name: "Set the maximum number of logs in the log buffer"
    community.network.ce_info_center_log:
      log_buff_size: 100
      provider: "{{ cli }}"

  - name: "Set a rule for outputting logs to a channel"
    community.network.ce_info_center_log:
      module_name: aaa
      channel_id: 1
      log_enable: true
      log_level: critical
      provider: "{{ cli }}"

返回值

常见的返回值在 此处 有记录,以下是此模块独有的字段

描述

changed

布尔值

检查设备上是否进行了更改

返回:始终

示例: true

end_state

字典

模块执行后配置的键值对

返回:详细模式

示例: {"log_time_stamp": "date_tenthsecond"}

existing

字典

现有配置的键值对

返回:详细模式

示例: {"log_time_stamp": "date_second"}

proposed

字典

传递到模块的参数的键值对

返回:详细模式

示例: {"log_time_stamp": "date_tenthsecond", "state": "present"}

updates

列表 / 元素=字符串

发送到设备的命令

返回:始终

示例: ["info-center timestamp log date precision-time tenth-second"]

状态

  • 此模块将在 6.0.0 版本中删除。 *[已弃用]*

  • 有关更多信息,请参阅 已弃用

作者

  • QijunPan (@QijunPan)