community.dns.remove_registrable_domain filter – Removes the registrable domain name from a DNS name
Note
This filter plugin is part of the community.dns collection (version 3.0.5).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.dns
.
To use it in a playbook, specify: community.dns.remove_registrable_domain
.
New in community.dns 0.1.0
Synopsis
Removes the registrable domain name from a DNS name.
Input
This describes the input of the filter, the value before | community.dns.remove_registrable_domain
.
Parameter |
Comments |
---|---|
A DNS name. |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1
, key2=value2
and so on in the following
example: input | community.dns.remove_registrable_domain(key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
This controls whether only entries from the ICANN section of the Public Suffix List are used, or also entries from the Private section. For example, Choices:
|
|
This controls whether the trailing period of the prefix (that is, the part before the registrable domain) is preserved or not. Choices:
|
|
This treats unknown TLDs as valid public suffixes. So for example the public suffix of This option corresponds to whether the global wildcard rule Choices:
|
|
This controls the behavior in case there is no label in front of the public suffix. This is the case if the DNS name itself is a public suffix. If set to If set to Choices:
|
Examples
- 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'
Return Value
Key |
Description |
---|---|
The part of the DNS name before the registrable domain. Returned: success |