cisco.iosxr.iosxr_system 模块 – 用于管理系统属性的模块。

注意

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

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

要安装它,请使用:ansible-galaxy collection install cisco.iosxr。您需要满足其他要求才能使用此模块,有关详细信息,请参阅要求

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

cisco.iosxr 1.0.0 中的新增功能

概要

  • 此模块提供 Cisco IOS XR 设备上节点系统属性的声明式管理。它提供配置主机系统参数或从设备活动配置中删除这些参数的选项。

要求

执行此模块的主机需要满足以下要求。

  • 使用 netconf 时需要 ncclient >= 0.5.3

  • 使用 netconf 时需要 lxml >= 4.1.1

参数

参数

注释

domain_name

字符串

将远程设备上的 IP 域名配置为提供的值。该值应为点分名称形式,并将附加到 hostname 以创建完全限定域名。

列表 / 元素=字符串

提供要附加到主机名的域名后缀列表,以进行名称解析。此参数接受名称列表,并将与运行节点上的当前活动配置进行协调。

hostname

字符串

配置设备主机名参数。此选项采用 ASCII 字符串值。

lookup_enabled

布尔值

提供启用或禁用 DNS 查找的管理控制。当此参数设置为 True 时,将执行查找;当设置为 False 时,不执行查找。

选择

  • false

  • true ← (默认)

lookup_source

字符串

lookup_source 参数提供一个或多个用于执行 DNS 查找的源接口。lookup_source 中提供的接口必须是设备上配置的有效接口。

name_servers

列表 / 元素=字符串

name_serves 参数接受一个 DNS 名称服务器列表,该列表以 FQDN 或 IP 地址的形式提供,用于执行名称解析查找。此参数接受 DNS 服务器列表。请参见示例。

state

字符串

设备当前活动配置中配置值的状态。当设置为 present 时,这些值应在设备活动配置中配置;当设置为 absent 时,这些值不应在设备活动配置中。

选择

  • "present" ← (默认)

  • "absent"

vrf

字符串

域服务的 VRF 名称

默认值: "default"

注意

注意

  • 此模块使用 network_clinetconf 连接工作。请参阅IOS-XR 平台选项

  • 使用 netconf 传输的名称服务器 state=absent 操作成功,但会出现 rpc-error。这是由于 XR 平台问题。建议将 ignore_errors 选项与任务一起使用作为解决方法。

  • 有关使用 Ansible 管理网络设备的更多信息,请参阅 :ref:`Ansible 网络指南 `

  • 有关使用 Ansible 管理 Cisco 设备的更多信息,请参阅 `Cisco 集成页面 <https://ansible.org.cn/integrations/networks/cisco>`_。

示例

- name: configure hostname and domain-name (default vrf=default)
  cisco.iosxr.iosxr_system:
    hostname: iosxr01
    domain_name: test.example.com
    domain_search:
      - ansible.com
      - redhat.com
      - cisco.com
- name: remove configuration
  cisco.iosxr.iosxr_system:
    hostname: iosxr01
    domain_name: test.example.com
    domain_search:
      - ansible.com
      - redhat.com
      - cisco.com
    state: absent
- name: configure hostname and domain-name with vrf
  cisco.iosxr.iosxr_system:
    hostname: iosxr01
    vrf: nondefault
    domain_name: test.example.com
    domain_search:
      - ansible.com
      - redhat.com
      - cisco.com
- name: configure DNS lookup sources
  cisco.iosxr.iosxr_system:
    lookup_source: MgmtEth0/0/CPU0/0
    lookup_enabled: true
- name: configure name servers
  cisco.iosxr.iosxr_system:
    name_servers:
      - 8.8.8.8
      - 8.8.4.4

返回值

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

描述

commands

列表 / 元素=字符串

要发送到设备的配置模式命令列表

已返回: 始终

示例: ["hostname iosxr01", "ip domain-name test.example.com"]

xml

列表 / 元素=字符串

通过 netconf 传输发送到设备的 NetConf rpc xml

返回: 总是返回 (当没有 xml rpc 发送时返回空列表)

示例: ["<config xmlns:xc=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <ip-domain xmlns=\"http://cisco.com/ns/yang/Cisco-IOS-XR-ip-domain-cfg\"> <vrfs> <vrf> <vrf-name>default</vrf-name> <lists> <list xc:operation=\"merge\"> <order>0</order> <list-name>redhat.com</list-name> </list> </lists> </vrf> </vrfs> </ip-domain> </config>"]

作者

  • Peter Sprygada (@privateip)

  • Kedar Kekan (@kedarX)