community.dns.get_public_suffix (2.8.3) — filter

Returns the public suffix of a DNS name

| "added in version" 0.1.0 of community.dns"

Authors: Felix Fontein (@felixfontein)

Install collection

Install with ansible-galaxy collection install community.dns:==2.8.3


Add to requirements.yml

  collections:
    - name: community.dns
      version: 2.8.3

Description

Returns the public suffix of a DNS name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Extract the public suffix from a DNS name
  ansible.builtin.set_fact:
    public_suffix: "{{ 'www.ansible.co.uk' | community.dns.get_public_suffix }}"

Inputs

    
_input:
    description:
    - A DNS name.
    required: true
    type: string

icann_only:
    default: false
    description:
    - 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, C(.co.uk) is in
      the ICANN section, but C(github.io) is in the Private section.
    type: boolean

normalize_result:
    default: false
    description:
    - "This controls whether the result is reconstructed from the normalized name used\
      \ during lookup. During normalization, ulabels are converted to alabels, and every\
      \ label is converted to lowercase. For example, the ulabel C(\xEB\xE7\xE3mpl\xEA\
      ) is converted to C(xn--mpl-llatwb) (puny-code), and C(Example.COM) is converted\
      \ to C(example.com)."
    type: boolean

keep_leading_period:
    default: true
    description:
    - This controls whether the leading period of a public suffix is preserved or not.
    type: boolean

keep_unknown_suffix:
    default: true
    description:
    - This treats unknown TLDs as valid public suffixes. So for example the public suffix
      of C(example.tlddoesnotexist) is C(.tlddoesnotexist) if this is V(true). If set
      to V(false), it will return an empty string in this case.
    - This option corresponds to whether the global wildcard rule C(*) in the Public Suffix
      List is used or not.
    type: boolean

Outputs

_value:
  description: The public suffix.
  type: string