community.dns.unquote_txt filter – Unquotes a TXT record entry to a string

Note

This filter plugin is part of the community.dns collection (version 3.0.7).

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.unquote_txt.

New in community.dns 2.9.0

Synopsis

  • Given a (quoted) TXT entry content, extracts its value.

Input

This describes the input of the filter, the value before | community.dns.unquote_txt.

Parameter

Comments

Input

string / required

The string to unquote.

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.unquote_txt(key1=value1, key2=value2, ...)

Parameter

Comments

character_encoding

string

Whether to treat numeric escape sequences (\xyz) as octal or decimal numbers.

The default value decimal is compatible to RFC 1035.

Choices:

  • "decimal" ← (default)

  • "octal"

Examples

- name: Unquote a TXT entry
  ansible.builtin.set_fact:
    public_suffix: "{{ value | community.dns.unquote_txt }}"
    # Should result in 'this is a test'
  vars:
    value: >-
      "this is " "a test"

Return Value

Key

Description

Return value

string

The extracted string.

Returned: success

Authors

  • Felix Fontein (@felixfontein)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.