cisco.iosxr.iosxr_ntp_global 模块 – 用于配置 NTP 的资源模块。

注意

此模块是 cisco.iosxr 集合(版本 10.2.2)的一部分。

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

要安装它,请使用: ansible-galaxy collection install cisco.iosxr

要在 playbook 中使用它,请指定: cisco.iosxr.iosxr_ntp_global

cisco.iosxr 2.5.0 中的新增功能

概要

  • 此模块在 Cisco IOSXR 平台上配置和管理 ntp 的属性。

参数

参数

注释

config

字典

ntp 选项的字典

access_group

字典

控制 NTP 访问

ipv4

字典

配置 IPv4 访问

peer

字符串

提供完全访问权限

query_only

字符串

仅允许控制查询。

serve

字符串

提供服务器和查询访问权限。

serve_only

字符串

仅提供服务器访问权限。

ipv6

字典

配置 IPv6 访问

peer

字符串

提供完全访问权限

query_only

字符串

仅允许控制查询。

serve

字符串

提供服务器和查询访问权限。

serve_only

字符串

仅提供服务器访问权限。

vrfs

列表 / 元素=字典

指定非默认 VRF。

ipv4

字典

配置 IPv4 访问

peer

字符串

提供完全访问权限

query_only

字符串

仅允许控制查询。

serve

字符串

提供服务器和查询访问权限。

serve_only

字符串

仅提供服务器访问权限。

ipv6

字典

配置 IPv6 访问

peer

字符串

提供完全访问权限

query_only

字符串

仅允许控制查询。

serve

字符串

提供服务器和查询访问权限。

serve_only

字符串

仅提供服务器访问权限。

name

字符串

指定非默认 VRF。

authenticate

布尔值

验证时间源

选项

  • false

  • true

authentication_keys

列表 / 元素=字典

用于可信时间源的身份验证密钥

encryption

布尔值

密钥的加密或明文类型。

选项

  • false

  • true

id

整数

<1-65535> 密钥号

key

字符串

身份验证密钥。

broadcastdelay

整数

估计的往返延迟,以微秒为单位。

drift

字典

漂移(思科支持)

aging_time

整数

老化时间,以小时为单位。

file

字符串

用于漂移值的文件。

interfaces

列表 / 元素=字典

在接口上配置 NTP。

broadcast_client

布尔值

监听 NTP 广播

选项

  • false

  • true

broadcast_destination

字符串

配置广播目标地址。

broadcast_key

整数

广播密钥号。

broadcast_version

整数

<2-4> NTP 版本号。

multicast_client

字符串

配置多播客户端

multicast_destination

字符串

配置多播目标

multicast_key

整数

配置多播身份验证密钥。

multicast_ttl

整数

配置要使用的 TTL。

multicast_version

整数

<2-4> NTP 版本号。

name

字符串

接口的名称。

vrf

字符串

vrf 的名称。

ipv4

字典

标记 ipv4 数据包的 dscp/优先级位。

dscp

字符串

设置 IP DSCP(差分服务代码点)。请参阅供应商文档以获取有效条目。

precedence

字符串

设置优先级。请参阅供应商文档以获取有效条目。

选项

  • "critical"

  • "flash"

  • "flash-override"

  • "immediate"

  • "internet"

  • "network"

  • "priority"

  • "routine"

ipv6

字典

标记 ipv4 数据包的 dscp/优先级位。

dscp

字符串

设置 IP DSCP(差分服务代码点)。请参阅供应商文档以获取有效条目。

precedence

字符串

设置优先级。请参阅供应商文档以获取有效条目。

选项

  • "critical"

  • "flash"

  • "flash-override"

  • "immediate"

  • "internet"

  • "network"

  • "priority"

  • "routine"

log_internal_sync

布尔值

记录内部同步更改。

选项

  • false

  • true

master

字典

充当 NTP 主时钟

stratum

整数

使用 NTP 作为时钟源,层数为 <1-15>

max_associations

整数

<0-4294967295> 关联的数量。

passive

布尔值

启用被动关联。

选项

  • false

  • true

peers

列表 / 元素=字典

配置 NTP 对等体。

burst

布尔值

使用突发模式。

选项

  • false

  • true

iburst

布尔值

使用初始突发模式。

选项

  • false

  • true

key_id

整数

S配置对等身份验证密钥

maxpoll

整数

配置最大轮询间隔。

minpoll

整数

配置最小轮询间隔。

peer

字符串 / 必填

主机名或 A.B.C.D 或 A:B:C:D:E:F:G:H。

prefer

布尔值

尽可能首选此对等体

选项

  • false

  • true

source

字符串

用于源地址的接口。

version

整数

NTP 版本。

vrf

字符串

vrf 名称。

servers

列表 / 元素=字典

配置 NTP 服务器。

burst

布尔值

使用突发模式。

选项

  • false

  • true

iburst

布尔值

使用初始突发模式。

选项

  • false

  • true

key_id

整数

S配置对等身份验证密钥

maxpoll

整数

配置最大轮询间隔。

minpoll

整数

配置最小轮询间隔。

prefer

布尔值

尽可能首选此对等体

选项

  • false

  • true

server

字符串 / 必填

主机名或 A.B.C.D 或 A:B:C:D:E:F:G:H。

source

字符串

用于源地址的接口。

version

整数

NTP 版本。

vrf

字符串

vrf 名称。

source_interface

字符串

配置默认接口。

source_vrfs

列表 / 元素=字典

配置默认接口。

name

字符串

源接口的名称。

vrf

字符串

vrf 名称。

trusted_keys

列表 / 元素=字典

用于可信时间源的密钥号列表。

key_id

整数

用于可信时间源的密钥号。

update_calendar

布尔值

定期使用 NTP 时间更新日历。

选项

  • false

  • true

running_config

字符串

此选项仅在状态为 parsed 时使用。

此选项的值应是通过执行命令 show running-config ntp 从 IOSXR 设备收到的输出。

状态 parsedrunning_config 选项中读取配置,并根据资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将以结果中的 parsed 键返回。

state

字符串

配置应保持的状态。

选项

  • "deleted"

  • "merged" ← (默认)

  • "overridden"

  • "replaced"

  • "gathered"

  • "rendered"

  • "parsed"

注释

注意

  • 针对 IOSXR 7.0.2 进行了测试。

  • 此模块适用于连接 network_cli

示例

# Using state: merged
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config ntp
# --------------------- EMPTY -----------------
# Merged play:
# ------------
- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_ntp_global:
    config:
      access_group:
        ipv4:
          peer: PeerAcl1
          query_only: QueryOnlyAcl1
          serve: ServeAcl1
          serve_only: ServeOnlyAcl1
        vrfs:
          - ipv4:
              peer: PeerAcl3
              serve: ServeAcl2
            name: siteA
      authenticate: true
      broadcastdelay: 1
      drift:
        aging_time: 0
        file: apphost
      interfaces:
        - name: GigabitEthernet0/0/0/0
          multicast_client: 224.0.0.8
          multicast_destination: 224.0.0.8
          broadcast_client: true
      ipv4:
        dscp: af11
      ipv6:
        precedence: routine
      log_internal_sync: true
      master: 1
      max_associations: 10
      passive: true
      peers:
        - iburst: true
          peer: 192.0.2.1
          vrf: siteC
      servers:
        - burst: true
          server: 192.0.2.2
          vrf: siteD
      source: GigabitEthernet0/0/0/0
      source_vrfs:
        - name: GigabitEthernet0/0/0/0
          vrf: siteE
      trusted_keys:
        - key_id: 1
      update_calendar: true
# Commands Fired:
# ------------
# "commands": [
#         "ntp peer vrf siteC 192.0.2.1 iburst ",
#         "ntp server vrf siteD 192.0.2.2 burst ",
#         "ntp trusted-key 1",
#         "ntp interface GigabitEthernet0/0/0/0 broadcast client",
#         "ntp interface GigabitEthernet0/0/0/0 multicast destination 224.0.0.8",
#         "ntp interface GigabitEthernet0/0/0/0 multicast client 224.0.0.8",
#         "ntp vrf siteE source GigabitEthernet0/0/0/0",
#         "ntp access-group vrf siteA ipv4 serve ServeAcl2",
#         "ntp access-group vrf siteA ipv4 peer PeerAcl3",
#         "ntp access-group ipv4 peer PeerAcl1",
#         "ntp access-group ipv4 serve ServeAcl1",
#         "ntp access-group ipv4 serve-only ServeOnlyAcl1",
#         "ntp access-group ipv4 query-only QueryOnlyAcl1",
#         "ntp authenticate",
#         "ntp log-internal-sync",
#         "ntp broadcastdelay 1",
#         "ntp drift aging time 0",
#         "ntp drift file apphost",
#         "ntp ipv4 dscp af11",
#         "ntp ipv6 precedence routine",
#         "ntp max-associations 10",
#         "ntp master 1",
#         "ntp passive",
#         "ntp update-calendar",
#         "ntp source GigabitEthernet0/0/0/0"
#     ],
# After state:
# ------------
# RP/0/0/CPU0:10#show running-config ntp
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Using state: deleted
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config ntp
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Deleted play:
# -------------
- name: Remove all existing configuration
  cisco.iosxr.iosxr_ntp_global:
    state: deleted
# Commands Fired:
# ---------------
# "commands": [
#         "no ntp peer vrf siteC 192.0.2.1 iburst ",
#         "no ntp server vrf siteD 192.0.2.2 burst ",
#         "no ntp trusted-key 1",
#         "no ntp interface GigabitEthernet0/0/0/0",
#         "no ntp vrf siteE source GigabitEthernet0/0/0/0",
#         "no ntp access-group vrf siteA ipv4 serve ServeAcl2",
#         "no ntp access-group vrf siteA ipv4 peer PeerAcl3",
#         "no ntp access-group ipv4 peer PeerAcl1",
#         "no ntp access-group ipv4 serve ServeAcl1",
#         "no ntp access-group ipv4 serve-only ServeOnlyAcl1",
#         "no ntp access-group ipv4 query-only QueryOnlyAcl1",
#         "no ntp authenticate",
#         "no ntp log-internal-sync",
#         "no ntp broadcastdelay 1",
#         "no ntp drift aging time 0",
#         "no ntp drift file apphost",
#         "no ntp ipv4 dscp af11",
#         "no ntp ipv6 precedence routine",
#         "no ntp max-associations 10",
#         "no ntp master 1",
#         "no ntp passive",
#         "no ntp update-calendar",
#         "no ntp source GigabitEthernet0/0/0/0"
#     ],
# After state:
# ------------
# RP/0/0/CPU0:10#show running-config ntp
# --------------------- EMPTY -----------------
# Using state: overridden
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config ntp
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Overridden play:
# ----------------
- name: Override BGP configuration with provided configuration
  cisco.iosxr.iosxr_ntp_global:
    state: overridden
    config:
      access_group:
        ipv4:
          peer: PeerAcl1
          query_only: QueryOnlyAcl1
          serve: ServeAcl4
          serve_only: ServeOnlyAcl1
        vrfs:
          - ipv4:
              peer: PeerAcl3
              serve: ServeAcl2
            name: siteA
      authenticate: true
      broadcastdelay: 1
      drift:
        aging_time: 0
        file: apphost
      interfaces:
        - name: GigabitEthernet0/0/0/1
          multicast_client: 224.0.0.8
          multicast_destination: 224.0.0.8
          broadcast_client: true
      ipv4:
        dscp: af12
      ipv6:
        precedence: routine
      log_internal_sync: true
      master: 1
      max_associations: 10
      passive: true
      peers:
        - iburst: true
          peer: 192.0.2.3
          vrf: siteC
      servers:
        - burst: true
          server: 192.0.2.2
          vrf: siteD
      source: GigabitEthernet0/0/0/1
      source_vrfs:
        - name: GigabitEthernet0/0/0/0
          vrf: siteE
      trusted_keys:
        - key_id: 1
      update_calendar: true
# Commands Fired:
# ---------------
# "commands": [
#         "no ntp peer vrf siteC 192.0.2.1 iburst ",
#         "no ntp interface GigabitEthernet0/0/0/0",
#         "ntp peer vrf siteC 192.0.2.3 iburst ",
#         "ntp interface GigabitEthernet0/0/0/1 broadcast client",
#         "ntp interface GigabitEthernet0/0/0/1 multicast destination 224.0.0.8",
#         "ntp interface GigabitEthernet0/0/0/1 multicast client 224.0.0.8",
#         "ntp access-group ipv4 serve ServeAcl4",
#         "ntp ipv4 dscp af12",
#         "ntp source GigabitEthernet0/0/0/1"
#     ],
# After state:
# ------------
# RP/0/RP0/CPU0:ios#show running-config ntp
# Mon Sep 13 10:38:22.690 UTC
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/1
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authentication-key 1 md5 encrypted testkey
#  authenticate
#  trusted-key 1
#  ipv4 dscp af12
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.3 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl4
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/1
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
#
# Using state: replaced
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config ntp
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Replaced play:
# ----------------
- name: Replaced BGP configuration with provided configuration
  cisco.iosxr.iosxr_ntp_global:
    state: replaced
    config:
      access_group:
        ipv4:
          peer: PeerAcl1
          query_only: QueryOnlyAcl1
          serve: ServeAcl4
          serve_only: ServeOnlyAcl1
        vrfs:
          - ipv4:
              peer: PeerAcl3
              serve: ServeAcl2
            name: siteA
      authenticate: true
      broadcastdelay: 1
      drift:
        aging_time: 0
        file: apphost
      interfaces:
        - name: GigabitEthernet0/0/0/1
          multicast_client: 224.0.0.8
          multicast_destination: 224.0.0.8
          broadcast_client: true
      ipv4:
        dscp: af12
      ipv6:
        precedence: routine
      log_internal_sync: true
      master: 1
      max_associations: 10
      passive: true
      peers:
        - iburst: true
          peer: 192.0.2.3
          vrf: siteC
      servers:
        - burst: true
          server: 192.0.2.2
          vrf: siteD
      source: GigabitEthernet0/0/0/1
      source_vrfs:
        - name: GigabitEthernet0/0/0/0
          vrf: siteE
      trusted_keys:
        - key_id: 1
      update_calendar: true
# Commands Fired:
# ---------------
# "commands": [
#         "no ntp peer vrf siteC 192.0.2.1 iburst ",
#         "no ntp interface GigabitEthernet0/0/0/0",
#         "ntp peer vrf siteC 192.0.2.3 iburst ",
#         "ntp interface GigabitEthernet0/0/0/1 broadcast client",
#         "ntp interface GigabitEthernet0/0/0/1 multicast destination 224.0.0.8",
#         "ntp interface GigabitEthernet0/0/0/1 multicast client 224.0.0.8",
#         "ntp access-group ipv4 serve ServeAcl4",
#         "ntp ipv4 dscp af12",
#         "ntp source GigabitEthernet0/0/0/1"
#     ],
# After state:
# ------------
# RP/0/RP0/CPU0:ios#show running-config ntp
# Mon Sep 13 10:38:22.690 UTC
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/1
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authentication-key 1 md5 encrypted testkey
#  authenticate
#  trusted-key 1
#  ipv4 dscp af12
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.3 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl4
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/1
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Using state: gathered
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config ntp
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Gathered play:
# --------------
- name: Gather listed ntp config
  cisco.iosxr.iosxr_ntp_global:
    state: gathered
# Module Execution Result:
# ------------------------
# "gathered":{
#         "access_group": {
#             "ipv4": {
#                 "peer": "PeerAcl1",
#                 "query_only": "QueryOnlyAcl1",
#                 "serve": "ServeAcl1",
#                 "serve_only": "ServeOnlyAcl1"
#             },
#             "vrfs": [
#                 {
#                     "ipv4": {
#                         "peer": "PeerAcl3",
#                         "serve": "ServeAcl2"
#                     },
#                     "name": "siteA"
#                 }
#             ]
#         },
#         "authenticate": true,
#         "broadcastdelay": 1,
#         "drift": {
#             "aging_time": 0,
#             "file": "apphost"
#         },
#         "interfaces": [
#             {
#                 "broadcast_client": true,
#                 "multicast_client": "224.0.0.8",
#                 "multicast_destination": "224.0.0.8",
#                 "name": "GigabitEthernet0/0/0/0"
#             }
#         ],
#         "ipv4": {
#             "dscp": "af11"
#         },
#         "ipv6": {
#             "precedence": "routine"
#         },
#         "log_internal_sync": true,
#         "master": 1,
#         "max_associations": 10,
#         "passive": true,
#         "peers": [
#             {
#                 "iburst": true,
#                 "peer": "192.0.2.1",
#                 "vrf": "siteC"
#             }
#         ],
#         "servers": [
#             {
#                 "burst": true,
#                 "server": "192.0.2.2",
#                 "vrf": "siteD"
#             }
#         ],
#         "source": "GigabitEthernet0/0/0/0",
#         "source_vrfs": [
#             {
#                 "name": "GigabitEthernet0/0/0/0",
#                 "vrf": "siteE"
#             }
#         ],
#         "trusted_keys": [
#             {
#                 "key_id": 1
#             }
#         ],
#         "update_calendar": true
#     }
# Using state: rendered
# Rendered play:
# --------------
- name: >-
    Render platform specific configuration lines with state rendered (without
    connecting to the device)
  cisco.iosxr.iosxr_ntp_global:
    state: rendered
    config:
      access_group:
        ipv4:
          peer: PeerAcl1
          query_only: QueryOnlyAcl1
          serve: ServeAcl1
          serve_only: ServeOnlyAcl1
        vrfs:
          - ipv4:
              peer: PeerAcl3
              serve: ServeAcl2
            name: siteA
      authenticate: true
      broadcastdelay: 1
      drift:
        aging_time: 0
        file: apphost
      interfaces:
        - name: GigabitEthernet0/0/0/0
          multicast_client: 224.0.0.8
          multicast_destination: 224.0.0.8
          broadcast_client: true
      ipv4:
        dscp: af11
      ipv6:
        precedence: routine
      log_internal_sync: true
      master: 1
      max_associations: 10
      passive: true
      peers:
        - iburst: true
          peer: 192.0.2.1
          vrf: siteC
      servers:
        - burst: true
          server: 192.0.2.2
          vrf: siteD
      source: GigabitEthernet0/0/0/0
      source_vrfs:
        - name: GigabitEthernet0/0/0/0
          vrf: siteE
      trusted_keys:
        - key_id: 1
      update_calendar: true
  register: result
# Module Execution Result:
# ------------------------
# "rendered": [
#         "ntp peer vrf siteC 192.0.2.1 iburst ",
#         "ntp server vrf siteD 192.0.2.2 burst ",
#         "ntp trusted-key 1",
#         "ntp interface GigabitEthernet0/0/0/0 broadcast client",
#         "ntp interface GigabitEthernet0/0/0/0 multicast destination 224.0.0.8",
#         "ntp interface GigabitEthernet0/0/0/0 multicast client 224.0.0.8",
#         "ntp vrf siteE source GigabitEthernet0/0/0/0",
#         "ntp access-group vrf siteA ipv4 serve ServeAcl2",
#         "ntp access-group vrf siteA ipv4 peer PeerAcl3",
#         "ntp access-group ipv4 peer PeerAcl1",
#         "ntp access-group ipv4 serve ServeAcl1",
#         "ntp access-group ipv4 serve-only ServeOnlyAcl1",
#         "ntp access-group ipv4 query-only QueryOnlyAcl1",
#         "ntp authenticate",
#         "ntp log-internal-sync",
#         "ntp broadcastdelay 1",
#         "ntp drift aging time 0",
#         "ntp drift file apphost",
#         "ntp ipv4 dscp af11",
#         "ntp ipv6 precedence routine",
#         "ntp max-associations 10",
#         "ntp master 1",
#         "ntp passive",
#         "ntp update-calendar",
#         "ntp source GigabitEthernet0/0/0/0"
#     ],
# Using state: parsed
# File: parsed.cfg
# ----------------
# ntp
#  max-associations 10
#  interface GigabitEthernet0/0/0/0
#   broadcast client
#   multicast client 224.0.0.8
#   multicast destination 224.0.0.8
#  !
#  authenticate
#  trusted-key 1
#  ipv4 dscp af11
#  ipv6 precedence routine
#  peer vrf siteC 192.0.2.1 iburst
#  server vrf siteD 192.0.2.2 burst
#  drift file apphost
#  drift aging time 0
#  master 1
#  access-group vrf siteA ipv4 peer PeerAcl3
#  access-group vrf siteA ipv4 serve ServeAcl2
#  access-group ipv4 peer PeerAcl1
#  access-group ipv4 serve ServeAcl1
#  access-group ipv4 serve-only ServeOnlyAcl1
#  access-group ipv4 query-only QueryOnlyAcl1
#  source vrf siteE GigabitEthernet0/0/0/0
#  source GigabitEthernet0/0/0/0
#  passive
#  broadcastdelay 1
#  update-calendar
#  log-internal-sync
# !
# Parsed play:
# ------------
- name: Parse the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_ntp_global:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Module Execution Result:
# ------------------------
# "parsed":{
#         "access_group": {
#             "ipv4": {
#                 "peer": "PeerAcl1",
#                 "query_only": "QueryOnlyAcl1",
#                 "serve": "ServeAcl1",
#                 "serve_only": "ServeOnlyAcl1"
#             },
#             "vrfs": [
#                 {
#                     "ipv4": {
#                         "peer": "PeerAcl3",
#                         "serve": "ServeAcl2"
#                     },
#                     "name": "siteA"
#                 }
#             ]
#         },
#         "authenticate": true,
#         "broadcastdelay": 1,
#         "drift": {
#             "aging_time": 0,
#             "file": "apphost"
#         },
#         "interfaces": [
#             {
#                 "broadcast_client": true,
#                 "multicast_client": "224.0.0.8",
#                 "multicast_destination": "224.0.0.8",
#                 "name": "GigabitEthernet0/0/0/0"
#             }
#         ],
#         "ipv4": {
#             "dscp": "af11"
#         },
#         "ipv6": {
#             "precedence": "routine"
#         },
#         "log_internal_sync": true,
#         "master": 1,
#         "max_associations": 10,
#         "passive": true,
#         "peers": [
#             {
#                 "iburst": true,
#                 "peer": "192.0.2.1",
#                 "vrf": "siteC"
#             }
#         ],
#         "servers": [
#             {
#                 "burst": true,
#                 "server": "192.0.2.2",
#                 "vrf": "siteD"
#             }
#         ],
#         "source": "GigabitEthernet0/0/0/0",
#         "source_vrfs": [
#             {
#                 "name": "GigabitEthernet0/0/0/0",
#                 "vrf": "siteE"
#             }
#         ],
#         "trusted_keys": [
#             {
#                 "key_id": 1
#             }
#         ],
#         "update_calendar": true
#     }

返回值

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

描述

after

字典

模块执行后的结果配置。

返回: 当更改时

示例: "此输出的格式始终与模块 argspec 的格式相同。\n"

before

字典

模块执行之前的配置。

返回:statemerged, replaced, overridden, deletedpurged

示例: "此输出的格式始终与模块 argspec 的格式相同。\n"

commands

list / elements=string

推送到远程设备的命令集。

返回:statemerged, replaced, overridden, deletedpurged

示例: ["sample command 1", "sample command 2", "sample command 3"]

gathered

list / elements=string

从远程设备收集的网络资源的事实,以结构化数据的形式呈现。

返回:stategathered

示例: ["此输出的格式将始终与模块的 argspec 相同。\n"]

parsed

list / elements=string

running_config 选项中提供的设备原生配置,按照模块的 argspec 解析为结构化数据。

返回:stateparsed

示例: ["此输出的格式将始终与模块的 argspec 相同。\n"]

rendered

list / elements=string

任务中提供的配置以设备原生格式渲染(离线)。

返回:staterendered

示例: ["sample command 1", "sample command 2", "sample command 3"]

作者

  • Ashwini Mhatre (@amhatre)