infoblox.nios_modules.nios_srv_record 模块 – 配置 Infoblox NIOS SRV 记录

注意

此模块是 infoblox.nios_modules 集合 (版本 1.7.1) 的一部分。

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

要安装它,请使用:ansible-galaxy collection install infoblox.nios_modules。您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。

要在 playbook 中使用它,请指定:infoblox.nios_modules.nios_srv_record

infoblox.nios_modules 1.0.0 中的新增功能

概要

  • 从 Infoblox NIOS 服务器添加和/或删除 SRV 记录对象的实例。此模块使用通过 REST 的 Infoblox WAPI 接口管理 NIOS record:srv 对象。

要求

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

  • infoblox-client

参数

参数

注释

comment

字符串

配置要与此对象的实例关联的文本字符串注释。提供的文本字符串将在对象实例上配置。

extattrs

字典

允许在对象实例上配置可扩展属性。此参数接受一组用于配置的键/值对。

name

字符串 / 必需

指定要从系统中添加或删除的完全限定主机名。用户还可以更新名称,因为可以传递包含new_nameold_name 的字典。请参阅示例。

port

整数

配置此 SRV 记录的端口 (0-65535)。

priority

整数

配置此 SRV 记录的优先级 (0-65535)。

provider

字典

一个包含连接详细信息的字典对象。

cert

字符串

指定客户端证书文件,其中包含 x509 配置的摘要,以便为 NIOS 的远程实例提供额外的安全连接层。

也可以使用 INFOBLOX_CERT 环境变量指定值。

host

字符串

指定用于通过 REST 连接到 NIOS WAPI 远程实例的 DNS 主机名或地址

也可以使用 INFOBLOX_HOST 环境变量指定值。

http_pool_connections

整数

在此处插入描述

默认值: 10

http_pool_maxsize

整数

在此处插入描述

默认值: 10

http_request_timeout

整数

在收到响应之前等待的时间

也可以使用 INFOBLOX_HTTP_REQUEST_TIMEOUT 环境变量指定值。

默认值: 10

key

字符串

指定私钥文件,用于使用证书进行加密,以便与 NIOS 的远程实例连接。

也可以使用 INFOBLOX_KEY 环境变量指定值。

max_results

整数

指定要返回的最大对象数,如果设置为负数,则当返回的对象数超过设置时,设备将返回错误。

也可以使用 INFOBLOX_MAX_RESULTS 环境变量指定值。

默认值: 1000

max_retries

整数

配置在声明连接可用之前尝试的重试次数

也可以使用 INFOBLOX_MAX_RETRIES 环境变量指定值。

默认值: 3

password

字符串

指定用于验证与 NIOS 远程实例连接的密码。

也可以使用 INFOBLOX_PASSWORD 环境变量指定值。

silent_ssl_warnings

布尔值

在此处插入描述

选择

  • false

  • true ← (默认)

username

字符串

配置用于验证与 NIOS 远程实例连接的用户名。

也可以使用 INFOBLOX_USERNAME 环境变量指定值。

validate_certs

别名:ssl_verify

布尔值

用于启用或禁用验证 SSL 证书的布尔值

也可以使用 INFOBLOX_SSL_VERIFY 环境变量指定值。

选择

  • false ← (默认)

  • true

wapi_version

字符串

指定要使用的 WAPI 版本

也可以使用 INFOBLOX_WAPI_VERSION 环境变量指定值。

在 Ansible 2.8 版本之前,默认的 WAPI 版本是 1.4。

默认: "2.12.3"

state

字符串

配置 NIOS 服务器上对象的预期状态。当此值设置为 present 时,会在设备上配置该对象;当此值设置为 absent 时,会从设备上删除该值(如果需要)。

选择

  • "present" ← (默认)

  • "absent"

target

字符串

配置此 SRV 记录的目标 FQDN。

ttl

整数

配置要与此主机记录关联的 TTL。

view

别名: dns_view

字符串

设置与此记录关联的 DNS 视图。DNS 视图必须已在系统上配置。

默认: "default"

weight

整数

配置此 SRV 记录的权重 (0-65535)。

说明

注意

  • 此模块支持 check_mode

  • 此模块必须在本地运行,可以通过指定 connection: local 来实现。

  • 请阅读 :ref:`nios_guide` 以获取有关如何将 Infoblox 与 Ansible 结合使用的更多详细信息。

示例

- name: Configure an SRV record
  infoblox.nios_modules.nios_srv_record:
    name: _sip._tcp.service.ansible.com
    port: 5080
    priority: 10
    target: service1.ansible.com
    weight: 10
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

- name: Add a comment to an existing SRV record
  infoblox.nios_modules.nios_srv_record:
    name: _sip._tcp.service.ansible.com
    port: 5080
    priority: 10
    target: service1.ansible.com
    weight: 10
    comment: this is a test comment
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

- name: Update name of SRV record
  infoblox.nios_modules.nios_srv_record:
    name: {old_name: _sip._tcp.service.ansible.com, new_name: _sip._udp.service.ansible.com}
    port: 5080
    priority: 10
    target: service1.ansible.com
    weight: 10
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

- name: Remove an SRV record from the system
  infoblox.nios_modules.nios_srv_record:
    name: _sip._tcp.service.ansible.com
    port: 5080
    priority: 10
    target: service1.ansible.com
    weight: 10
    state: absent
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

作者

  • Blair Rampling (@brampling)