community.dns.remove_registrable_domain 过滤器 – 从 DNS 名称中移除可注册域名

注意

此过滤器插件是 community.dns 集合 (版本 3.1.0) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install community.dns

要在 playbook 中使用它,请指定: community.dns.remove_registrable_domain

community.dns 0.1.0 中的新增功能

概要

  • 从 DNS 名称中移除可注册域名。

输入

这描述了过滤器的输入,即 | community.dns.remove_registrable_domain 之前的值。

参数

注释

输入

字符串 / 必需

DNS 名称。

关键字参数

这描述了过滤器的关键字参数。这些是以下示例中 key1=value1key2=value2 等值: input | community.dns.remove_registrable_domain(key1=value1, key2=value2, ...)

参数

注释

icann_only

布尔值

这控制是否仅使用公共后缀列表的 ICANN 部分中的条目,或者也使用私有部分中的条目。例如,.co.uk 在 ICANN 部分中,但 github.io 在私有部分中。

选择

  • false ←(默认)

  • true

keep_trailing_period

布尔值

这控制是否保留前缀(即可注册域名之前的部分)的尾随句点。

选择

  • false ←(默认)

  • true

keep_unknown_suffix

布尔值

这会将未知的 TLD 视为有效的公共后缀。因此,例如,如果这是 true,则 example.tlddoesnotexist 的公共后缀为 .tlddoesnotexist,因此 www.example.tlddoesnotexist 的可注册域名为 example.tlddoesnotexist。如果设置为 false,则 www.example.tlddoesnotexist 的可注册域名为 tlddoesnotexist

此选项对应于是否使用公共后缀列表中的全局通配符规则 *

选择

  • false

  • true ←(默认)

only_if_registerable

布尔值

这控制在公共后缀前面没有标签时的行为。如果 DNS 名称本身是公共后缀,则会出现这种情况。

如果设置为 false,则在这种情况下,公共后缀被视为可注册域名。

如果设置为 true (默认),则公共后缀的可注册域名被解释为空字符串。

选择

  • false

  • true ←(默认)

示例

- name: Remove the registrable domain from a DNS name
  ansible.builtin.set_fact:
    public_suffix: "{{ 'www.ansible.co.uk' | community.dns.remove_registrable_domain }}"
    # Should result in 'www'

返回值

描述

返回值

字符串

DNS 名称中可注册域名之前的部分。

返回:成功

作者

  • Felix Fontein (@felixfontein)

提示

每个条目类型的配置条目都具有从低到高的优先级顺序。例如,列表中较低的变量将覆盖较高的变量。