dellemc.enterprise_sonic.sonic_ntp 模块 – 管理 SONiC 上的 NTP 配置。
注意
此模块是 dellemc.enterprise_sonic 集合(版本 2.5.1)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install dellemc.enterprise_sonic
。
要在 playbook 中使用它,请指定:dellemc.enterprise_sonic.sonic_ntp
。
dellemc.enterprise_sonic 2.0.0 中的新增功能
概要
此模块为运行 SONiC 的设备提供 NTP 的配置管理。
参数
参数 |
注释 |
---|---|
指定 NTP 相关配置。 |
|
启用或禁用 NTP 身份验证。 选择
|
|
NTP 身份验证密钥的列表。 |
|
NTP 身份验证 key_value 已加密。 无法删除 encrypted。 当“state”为“merged”时,需要“encrypted”。 选择
|
|
NTP 身份验证密钥标识符。 |
|
NTP 身份验证密钥类型。 无法删除 key_type。 当“state”为“merged”时,需要“key_type”。 选择
|
|
NTP 身份验证密钥值。 无法删除 key_value。 当“state”为“merged”时,需要“key_value”。 |
|
NTP 服务器列表。 minpoll 和 maxpoll 需要一起配置。 |
|
NTP 服务器的 IPv4/IPv6 地址或主机名。 |
|
整数 服务器使用的 NTP 身份验证密钥。 |
|
maxpoll 轮询 NTP 服务器的最大轮询间隔。 |
|
minpoll 轮询 NTP 服务器的最小轮询间隔。 |
|
prefer 指示是否应首选此服务器。 选择
|
|
列表 / 元素=字符串 |
|
列表 / 元素=整数 |
|
vrf |
|
state 选择
|
"deleted"
支持 check_mode
。
# Using deleted
#
# Before state:
# -------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#10.11.0.2 5 9 False
#dell.com 6 9 False
#dell.org 7 10 True
#
- name: Delete NTP server configuration
sonic_ntp:
config:
servers:
- address: 10.11.0.2
- address: dell.org
state: deleted
# After state:
# ------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#dell.com 6 9 False
#
#
# Using deleted
#
# Before state:
# -------------
#
#sonic# show ntp global
#----------------------------------------------
#NTP Global Configuration
#----------------------------------------------
#NTP source-interfaces: Ethernet0, Ethernet4, Ethernet8, Ethernet16
#
- name: Delete NTP source-interface configuration
sonic_ntp:
config:
source_interfaces:
- Ethernet8
- Ethernet16
state: deleted
# After state:
# ------------
#
#sonic# show ntp global
#----------------------------------------------
#NTP Global Configuration
#----------------------------------------------
#NTP source-interfaces: Ethernet0, Ethernet4
#
#
# Using deleted
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep ntp
#ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
#ntp authentication-key 10 md5 U2FsdGVkX1/Gxds/5pscCvIKbVngGaKka4SQineS51Y= encrypted
#ntp authentication-key 20 sha2-256 U2FsdGVkX1/eAzKj1teKhYWD7tnzOsYOijGeFAT0rKM= encrypted
#
- name: Delete NTP key configuration
sonic_ntp:
config:
ntp_keys:
- key_id: 10
- key_id: 20
state: deleted
#
# After state:
# ------------
#
#sonic# show running-configuration | grep ntp
#ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
#
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#dell.com 6 9 False
#
- name: Merge NTP server configuration
sonic_ntp:
config:
servers:
- address: 10.11.0.2
minpoll: 5
- address: dell.org
minpoll: 7
maxpoll: 10
prefer: true
state: merged
# After state:
# ------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 Flase
#10.11.0.2 5 10 Flase
#dell.com 6 9 Flase
#dell.org 7 10 True
#
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show ntp global
#----------------------------------------------
#NTP Global Configuration
#----------------------------------------------
#NTP source-interfaces: Ethernet0, Ethernet4
#
- name: Merge NTP source-interface configuration
sonic_ntp:
config:
source_interfaces:
- Ethernet8
- Ethernet16
state: merged
# After state:
# ------------
#
#sonic# show ntp global
#----------------------------------------------
#NTP Global Configuration
#----------------------------------------------
#NTP source-interfaces: Ethernet0, Ethernet4, Ethernet8, Ethernet16
#
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep ntp
#ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
#
- name: Merge NTP key configuration
sonic_ntp:
config:
ntp_keys:
- key_id: 10
key_type: NTP_AUTH_MD5
key_value: dellemc10
encrypted: false
- key_id: 20
key_type: NTP_AUTH_SHA2_256
key_value: dellemc20
encrypted: false
state: merged
#
# After state:
# ------------
#
#sonic# show running-configuration | grep ntp
#ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
#ntp authentication-key 10 md5 U2FsdGVkX1/Gxds/5pscCvIKbVngGaKka4SQineS51Y= encrypted
#ntp authentication-key 20 sha2-256 U2FsdGVkX1/eAzKj1teKhYWD7tnzOsYOijGeFAT0rKM= encrypted
#
# Using replaced
#
# Before state:
# -------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#dell.com 6 9 False
#
- name: Replace NTP server configuration
sonic_ntp:
config:
servers:
- address: 10.11.0.2
minpoll: 5
maxpoll: 9
- address: dell.com
minpoll: 7
maxpoll: 10
prefer: true
state: replaced
#
# After state:
# ------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#10.11.0.2 5 9 False
#dell.com 7 10 True
#
# Using overridden
#
# Before state:
# -------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.1 6 10 False
#dell.com 6 9 False
#
#sonic# show ntp global
#----------------------------------------------
#NTP Global Configuration
#----------------------------------------------
#NTP source-interfaces: Ethernet0, Ethernet4
#
- name: Overridden NTP configuration
sonic_ntp:
config:
servers:
- address: 10.11.0.2
minpoll: 5
- address: dell.com
minpoll: 7
maxpoll: 10
prefer: true
state: overridden
#
# After state:
# ------------
#
# After state:
# ------------
#
#sonic# show ntp server
#----------------------------------------------------------------------------
#NTP Servers minpoll maxpoll Prefer Authentication key ID
#----------------------------------------------------------------------------
#10.11.0.2 5 10 False
#dell.com 7 10 True
#
#sonic# show ntp global
#
示例
常见的返回值记录在此处,以下是此模块独有的字段 |
描述 |
---|---|
after 生成的配置模块调用。 已返回: 当更改时 |
|
after(generated) 生成的配置模块调用。 已返回: 当更改时 |
|
before 模块调用之前的配置。 已返回: 当更改时 |
|
commands 模块调用之前的配置。 推送到远程设备的命令集。 |