community.dns.remove_public_suffix (2.8.3) — filter

Removes the public suffix from 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

Removes the public suffix from a DNS name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove the public suffix from a DNS name
  ansible.builtin.set_fact:
    public_suffix: "{{ 'www.ansible.co.uk' | community.dns.remove_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

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

keep_trailing_period:
    default: false
    description:
    - This controls whether the trailing period of the prefix (that is, the part before
      the public suffix) is preserved or not.
    type: boolean

Outputs

_value:
  description: The part of the DNS name before the public suffix.
  type: string