community.dns.hetzner_dns_record_set_info (2.8.3) — module

Retrieve record sets in Hetzner DNS service

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

Authors: Markus Bergholz (@markuman) <markuman+spambelongstogoogle@gmail.com>, 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

Retrieves DNS record sets in Hetzner DNS service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve the details for the A records of new.foo.com
  community.dns.hetzner_dns_record_set_info:
    zone: foo.com
    record: new.foo.com
    type: A
    hetzner_token: access_token
  register: rec
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print the A record set
  ansible.builtin.debug:
    msg: "{{ rec.set }}"

Inputs

    
type:
    choices:
    - A
    - AAAA
    - CAA
    - CNAME
    - DANE
    - DS
    - HINFO
    - MX
    - NS
    - RP
    - SOA
    - SRV
    - TLSA
    - TXT
    description:
    - The type of DNS record to retrieve.
    - Required if O(what) is V(single_record).
    type: str

what:
    choices:
    - single_record
    - all_types_for_record
    - all_records
    default: single_record
    description:
    - Describes whether to fetch a single record and type combination, all types for a
      record, or all records. By default, a single record and type combination is fetched.
    - Note that the return value structure depends on this option.
    type: str

prefix:
    description:
    - The prefix of the DNS record.
    - This is the part of O(record) before O(zone_name). For example, if the record to
      be modified is C(www.example.com) for the zone C(example.com), the prefix is V(www).
      If the record in this example would be C(example.com), the prefix would be V('')
      (empty string).
    - If O(what) is V(single_record) or V(all_types_for_record), exactly one of O(record)
      and O(prefix) is required.
    type: str
    version_added: 0.2.0
    version_added_collection: community.dns

record:
    description:
    - The full DNS record to retrieve.
    - If O(what) is V(single_record) or V(all_types_for_record), exactly one of O(record)
      and O(prefix) is required.
    type: str

zone_id:
    description:
    - The ID of the DNS zone to modify.
    - Exactly one of O(zone_name) and O(zone_id) must be specified.
    type: str
    version_added: 0.2.0
    version_added_collection: community.dns

zone_name:
    aliases:
    - zone
    description:
    - The DNS zone to modify.
    - Exactly one of O(zone_name) and O(zone_id) must be specified.
    type: str

hetzner_token:
    aliases:
    - api_token
    description:
    - The token for the Hetzner API.
    - If not provided, will be read from the environment variable E(HETZNER_DNS_TOKEN).
    required: true
    type: str

txt_transformation:
    choices:
    - api
    - quoted
    - unquoted
    default: unquoted
    description:
    - Determines how TXT entry values are converted between the API and this module's
      input and output.
    - The value V(api) means that values are returned from this module as they are returned
      from the API, and pushed to the API as they have been passed to this module. For
      idempotency checks, the input string will be compared to the strings returned by
      the API. The API might automatically transform some values, like splitting long
      values or adding quotes, which can cause problems with idempotency.
    - The value V(unquoted) automatically transforms values so that you can pass in unquoted
      values, and the module will return unquoted values. If you pass in quoted values,
      they will be double-quoted.
    - The value V(quoted) automatically transforms values so that you must use quoting
      for values that contain spaces, characters such as quotation marks and backslashes,
      and that are longer than 255 bytes. It also makes sure to return values from the
      API in a normalized encoding.
    - The default value, V(unquoted), ensures that you can work with values without having
      to care about how to correctly quote for DNS. Most users should use one of V(unquoted)
      or V(quoted), but not V(api).
    - B(Note:) the conversion code assumes UTF-8 encoding for values. If you need another
      encoding use O(txt_transformation=api) and handle the encoding yourself.
    type: str

txt_character_encoding:
    choices:
    - decimal
    - octal
    description:
    - Whether to treat numeric escape sequences (V(\\xyz)) as octal or decimal numbers.
      This is only used when O(txt_transformation=quoted).
    - The current default is V(octal) which is deprecated. It will change to V(decimal)
      in community.dns 3.0.0. The value V(decimal) is compatible to L(RFC 1035, https://www.ietf.org/rfc/rfc1035.txt).
    type: str
    version_added: 2.5.0
    version_added_collection: community.dns

Outputs

set:
  contains:
    prefix:
      description: The record prefix.
      sample: sample
      type: str
      version_added: 0.2.0
      version_added_collection: community.dns
    record:
      description: The record name.
      sample: sample.example.com
      type: str
    ttl:
      description:
      - The TTL.
      - If there are records in this set with different TTLs, the minimum of the TTLs
        will be presented here.
      - Will return V(none) if the zone's default TTL is used.
      sample: 3600
      type: int
    ttls:
      description:
      - If there are records with different TTL values in this set, this will be the
        list of TTLs appearing in the records.
      - Every distinct TTL will appear once, and the TTLs are in ascending order.
      elements: int
      returned: When there is more than one distinct TTL
      sample:
      - 300
      - 3600
      type: list
    type:
      description: The DNS record type.
      sample: A
      type: str
    value:
      description: The DNS record set's value.
      elements: str
      sample:
      - 1.2.3.4
      - 1.2.3.5
      type: list
  description: The fetched record set. Is empty if record set does not exist.
  returned: success and O(what) is V(single_record)
  sample:
    record: sample.example.com
    ttl: 3600
    type: A
    value:
    - 1.2.3.4
    - 1.2.3.5
  type: dict
sets:
  contains:
    prefix:
      description: The record prefix.
      sample: sample
      type: str
      version_added: 0.2.0
      version_added_collection: community.dns
    record:
      description: The record name.
      sample: sample.example.com
      type: str
    ttl:
      description:
      - The TTL.
      - If there are records in this set with different TTLs, the minimum of the TTLs
        will be presented here.
      - Will return V(none) if the zone's default TTL is used.
      sample: 3600
      type: int
    ttls:
      description:
      - If there are records with different TTL values in this set, this will be the
        list of TTLs appearing in the records.
      - Every distinct TTL will appear once, and the TTLs are in ascending order.
      elements: int
      returned: When there is more than one distinct TTL
      sample:
      - 300
      - 3600
      type: list
    type:
      description: The DNS record type.
      sample: A
      type: str
    value:
      description: The DNS record set's value.
      elements: str
      sample:
      - 1.2.3.4
      - 1.2.3.5
      type: list
  description: The list of fetched record sets.
  elements: dict
  returned: success and O(what) is not V(single_record)
  sample:
  - record: sample.example.com
    ttl: 3600
    type: A
    value:
    - 1.2.3.4
    - 1.2.3.5
  type: list
zone_id:
  description: The ID of the zone.
  returned: success
  sample: 23
  type: str
  version_added: 0.2.0
  version_added_collection: community.dns

See also