community.network.ce_ntp_auth 模块 – 管理华为 CloudEngine 交换机上的 NTP 身份验证配置。

注意

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

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

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

要在 playbook 中使用它,请指定:community.network.ce_ntp_auth

注意

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

已弃用

移除于:

版本 6.0.0

原因:

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

替代方案:

未知。

概要

  • 管理华为 CloudEngine 交换机上的 NTP 身份验证配置。

别名:network.cloudengine.ce_ntp_auth

参数

参数

注释

auth_mode

字符串

指定身份验证算法。

选择

  • "hmac-sha256"

  • "md5"

auth_pwd

字符串

长度为 1 到 255 的纯文本,长度为 20 到 392 的加密文本。

auth_type

字符串

给定密码是纯文本还是已加密。如果为纯文本,设备将在存储之前对其进行加密。

选择

  • "text"

  • "encrypt" ←(默认)

authentication

字符串

配置启用 ntp 身份验证或取消配置启用 ntp 身份验证。

选择

  • "enable"

  • "disable"

key_id

字符串 / 必需

身份验证密钥标识符(数字)。

state

字符串

管理资源的状态。

选择

  • "present" ←(默认)

  • "absent"

trusted_key

字符串

是否需要时间源提供给定的密钥,以便设备与该时间源同步。

选择

  • "enable"

  • "disable" ←(默认)

注释

注意

  • 如果 state=absent,该模块将尝试删除给定的密钥配置。如果在设备上找不到匹配的密钥配置,该模块将失败。

  • 如果 state=absentauthentication=on,则将启用身份验证。

  • 如果 state=absentauthentication=off,则将禁用身份验证。

  • 推荐的连接是 network_cli

  • 此模块也适用于传统 playbook 的 local 连接。

示例

- name: NTP AUTH test
  hosts: cloudengine
  connection: local
  gather_facts: false

  tasks:

  - name: "Configure ntp authentication key-id"
    community.network.ce_ntp_auth:
      key_id: 32
      auth_mode: md5
      auth_pwd: 11111111111111111111111

  - name: "Configure ntp authentication key-id and trusted authentication keyid"
    community.network.ce_ntp_auth:
      key_id: 32
      auth_mode: md5
      auth_pwd: 11111111111111111111111
      trusted_key: enable

  - name: "Configure ntp authentication key-id and authentication enable"
    community.network.ce_ntp_auth:
      key_id: 32
      auth_mode: md5
      auth_pwd: 11111111111111111111111
      authentication: enable

  - name: "Unconfigure ntp authentication key-id and trusted authentication keyid"
    community.network.ce_ntp_auth:
      key_id: 32
      state: absent

  - name: "Unconfigure ntp authentication key-id and authentication enable"
    community.network.ce_ntp_auth:
      key_id: 32
      authentication: enable
      state: absent

返回值

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

描述

changed

布尔值

检查设备是否进行了更改

返回: 始终

示例: true

end_state

字典

模块执行后 ntp 身份验证的键/值对

返回: 始终

示例: {"authentication": "off", "authentication-keyid": [{"auth_mode": "md5", "key_id": "1", "trusted_key": "disable"}, {"auth_mode": "md5", "key_id": "32", "trusted_key": "enable"}]}

existing

字典

现有 ntp 身份验证的键/值对

返回: 始终

示例: {"authentication": "off", "authentication-keyid": [{"auth_mode": "md5", "key_id": "1", "trusted_key": "disable"}]}

proposed

字典

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

返回: 始终

示例: {"auth_mode": "md5", "auth_pwd": "1111", "auth_type": "text", "authentication": "enable", "key_id": "32", "state": "present", "trusted_key": "enable"}

state

字符串

playbook 中发送的状态

返回: 始终

示例: "present"

updates

列表 / elements=string

发送到设备的命令

返回: 始终

示例: ["ntp authentication-key 32 md5 1111", "ntp trusted-key 32", "ntp authentication enable"]

状态

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

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

作者

  • 周志进 (@QijunPan)