community.windows.win_dns_zone 模块 – 管理 Windows Server DNS 区域
注意
此模块是 community.windows 集合 (版本 2.3.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.windows
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在剧本中使用它,请指定:community.windows.win_dns_zone
。
概要
管理 Windows Server DNS 区域
添加、删除和修改 DNS 区域 - 主区域、辅助区域、转发器和存根区域
任务应委托给 Windows DNS 服务器
要求
在执行此模块的主机上需要以下要求。
此模块需要 Windows Server 2012R2 或更高版本
参数
参数 |
注释 |
---|---|
指定区域主服务器的 IP 地址列表。 转发区域的 DNS 查询将发送到主服务器。 如果 l(type=secondary), l(type=forwarder) 或 l(type=stub),则需要此参数,否则将忽略。 至少需要一个服务器。 |
|
指定区域如何处理动态更新。 安全 DNS 更新仅适用于 Active Directory 集成的区域。 在创建新区域时未指定时,Windows 将默认将其设置为 l(none)。 选项
|
|
指定 DNS 服务器等待远程 DNS 服务器解析查询的时间长度(以秒为单位)。 接受 0 到 15 之间的整数。 如果提供的值无效,则会将其忽略并发出警告。 |
|
DNS 区域的完全限定名称。 |
|
指定 DNS 区域的复制范围。 l(replication=forest) 将 DNS 区域复制到 Active Directory 林中的所有域控制器。 l(replication=domain) 将 DNS 区域复制到 Active Directory 域中的所有域控制器。 l(replication=none) 禁用 Active Directory 集成并创建名称为区域名称的本地文件。 这等同于在 GUI 中选择 l(将区域存储在 Active Directory 中)。 选项
|
|
指定 DNS 区域的所需状态。 当 l(state=present) 时,如果指定的 DNS 区域不存在,模块将尝试创建它。 当 l(state=absent) 时,模块将删除指定的 DNS 区域及其所有后续 DNS 记录。 选项
|
|
指定 DNS 区域的类型。 当 l(type=secondary) 时,DNS 服务器将立即尝试从此列表中的服务器执行区域传输。如果此初始传输失败,则区域将处于不可用状态。此模块不验证初始传输。 选项
|
示例
- name: Ensure primary zone is present
community.windows.win_dns_zone:
name: wpinner.euc.vmware.com
replication: domain
type: primary
state: present
- name: Ensure DNS zone is absent
community.windows.win_dns_zone:
name: jamals.euc.vmware.com
state: absent
- name: Ensure forwarder has specific DNS servers
community.windows.win_dns_zone:
name: jamals.euc.vmware.com
type: forwarder
dns_servers:
- 10.245.51.100
- 10.245.51.101
- 10.245.51.102
- name: Ensure stub zone has specific DNS servers
community.windows.win_dns_zone:
name: virajp.euc.vmware.com
type: stub
dns_servers:
- 10.58.2.100
- 10.58.2.101
- name: Ensure stub zone is converted to a secondary zone
community.windows.win_dns_zone:
name: virajp.euc.vmware.com
type: secondary
- name: Ensure secondary zone is present with no replication
community.windows.win_dns_zone:
name: dgemzer.euc.vmware.com
type: secondary
replication: none
dns_servers:
- 10.19.20.1
- name: Ensure secondary zone is converted to a primary zone
community.windows.win_dns_zone:
name: dgemzer.euc.vmware.com
type: primary
replication: none
dns_servers:
- 10.19.20.1
- name: Ensure primary DNS zone is present without replication
community.windows.win_dns_zone:
name: basavaraju.euc.vmware.com
replication: none
type: primary
- name: Ensure primary DNS zone has nonsecureandsecure dynamic updates enabled
community.windows.win_dns_zone:
name: basavaraju.euc.vmware.com
replication: none
dynamic_update: nonsecureandsecure
type: primary
- name: Ensure DNS zone is absent
community.windows.win_dns_zone:
name: marshallb.euc.vmware.com
state: absent
- name: Ensure DNS zones are absent
community.windows.win_dns_zone:
name: "{{ item }}"
state: absent
loop:
- jamals.euc.vmware.com
- dgemzer.euc.vmware.com
- wpinner.euc.vmware.com
- marshallb.euc.vmware.com
- basavaraju.euc.vmware.com
返回值
常见的返回值已在此处记录 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
新的/更新的 DNS 区域参数 返回:当 l(state=present) 时 示例: |