### Install community.dns Collection Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Install the community.dns collection using the ansible-galaxy CLI. This command fetches and installs the collection and its dependencies. ```bash ansible-galaxy collection install community.dns ``` -------------------------------- ### Install lxml for WSDL API Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Ensure the lxml Python module is installed before using modules that interact with the WSDL API. ```yaml - name: Make sure lxml is installed pip: name: lxml ``` -------------------------------- ### Quote TXT Record Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Use the `quote_txt` filter to properly quote a string for inclusion in a DNS TXT record. This ensures correct formatting for TXT record values. ```jinja2 "this is a test" | community.dns.quote_txt == '"this is a test"' ``` -------------------------------- ### Get Registrable Domain Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Apply the `get_registrable_domain` filter to obtain the registrable domain name from a given domain. This filter is helpful for identifying the core domain for registration purposes. ```jinja2 "www.ansible.com" | community.dns.get_registrable_domain == "ansible.com" ``` ```jinja2 "some.random.prefixes.ansible.co.uk" | community.dns.get_registrable_domain == "ansible.co.uk" ``` -------------------------------- ### Add community.dns to requirements.yml Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Include the community.dns collection in your Ansible project's requirements.yml file for automated installation. This ensures the collection is available when running playbooks. ```yaml collections: - name: community.dns ``` -------------------------------- ### Get Public Suffix Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Use the `get_public_suffix` filter to extract the public suffix from a domain name. This is useful for domain analysis and manipulation. ```jinja2 "www.ansible.com" | community.dns.get_public_suffix == ".com" ``` ```jinja2 "some.random.prefixes.ansible.co.uk" | community.dns.get_public_suffix == ".co.uk" ``` -------------------------------- ### Provide Hetzner API Token Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Demonstrates how to pass the Hetzner API token to the module. This can be done directly or via environment variables. ```yaml - community.dns.hetzner_dns_record: hetzner_token: '{{ token }}' # ... ``` -------------------------------- ### Configure Hetzner DNS Module Defaults Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Sets default module parameters for Hetzner DNS modules using `module_defaults`. This avoids repetitive configuration in tasks. ```yaml --- - name: Hetzner DNS hosts: localhost gather_facts: false module_defaults: group/community.dns.hetzner: hetzner_token: '{{ token }}' tasks: - name: Query zone information community.dns.hetzner_dns_zone_info: zone_name: example.com register: result - name: Set A records for www.example.com community.dns.hetzner_dns_record_set: state: present zone_name: example.com type: A prefix: www value: - 192.168.0.1 ``` -------------------------------- ### Remove Registrable Domain Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Employ the `remove_registrable_domain` filter to remove the registrable domain part from a given domain name. This leaves the subdomain components, if any. ```jinja2 "www.ansible.com" | community.dns.remove_registrable_domain == "www" ``` ```jinja2 "some.random.prefixes.ansible.co.uk" | community.dns.remove_registrable_domain == "some.random.prefixes" ``` -------------------------------- ### Create/Update DNS Record Set (markuman.hetzner_dns) Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module for creating or updating a DNS record set when purge is true. ```yaml - name: Creating or updating a record set with markuman.hetzner_dns markuman.hetzner_dns.record: zone_name: example.com name: localhost type: A value: 127.0.0.1 ttl: 60 # This means the module operates on the record set: purge: true ``` -------------------------------- ### Create/Update Single DNS Record (markuman.hetzner_dns) Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module for creating or updating a single DNS record when purge is false. ```yaml - name: Creating or updating a single DNS record with markuman.hetzner_dns markuman.hetzner_dns.record: zone_name: example.com name: localhost type: A value: 127.0.0.1 ttl: 60 # This means the module operates on single DNS entries. If not specified, # this is the default value: purge: false ``` -------------------------------- ### Configure HostTech DNS Module Defaults Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Use the community.dns.hosttech module defaults group to avoid repetitive parameter specification for common options like authentication. ```yaml --- - name: Hosttech DNS hosts: localhost gather_facts: false module_defaults: group/community.dns.hosttech: hosttech_username: '{{ username }}' hosttech_password: '{{ password }}' tasks: - name: Query zone information community.dns.hosttech_dns_zone_info: zone_name: example.com register: result - name: Set A records for www.example.com community.dns.hosttech_dns_record_set: state: present zone_name: example.com type: A prefix: www value: - 192.168.0.1 ``` -------------------------------- ### Create/Update DNS Record Set (community.dns) Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module for creating or updating a DNS record set. Ensure 'state' is specified. 'name' is a deprecated alias for 'prefix'. 'value' is now a list. For TXT records, adjust the value or use 'txt_transformation'. ```yaml - name: Creating or updating a record set with community.dns community.dns.hetzner_dns_record_set: zone_name: example.com # 'state' must always be specified: state: present # 'name' is a deprecated alias of 'prefix', so it can be # kept during a first migration step: name: localhost # 'type' and 'ttl' do not change: type: A ttl: 60 # 'value' is now a list: value: - 127.0.0.1 # Ansible allows to specify lists as a comma-separated string. # So for records which do not contain a comma, you can also # keep the old syntax, in this case: # # value: 127.0.0.1 # # If type is TXT, you either have to adjust the value you pass, # or keep the following option: txt_transformation: api ``` -------------------------------- ### Remove Public Suffix Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Utilize the `remove_public_suffix` filter to strip the public suffix from a domain name. This returns the remaining part of the domain, excluding the TLD and its preceding public part. ```jinja2 "www.ansible.com" | community.dns.remove_public_suffix == "www.ansible" ``` ```jinja2 "some.random.prefixes.ansible.co.uk" | community.dns.remove_public_suffix == "some.random.prefixes.ansible" ``` -------------------------------- ### Unquote TXT Record Filter Example Source: https://github.com/ansible-collections/community.dns/blob/main/README.md Apply the `unquote_txt` filter to remove quotes from a string intended for a DNS TXT record. This is useful for parsing TXT record values that may contain quoted strings. ```jinja2 '"foo" "bar"' | community.dns.unquote_txt == "foobar" ``` -------------------------------- ### Run Nox Formatters Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Execute only the code formatting tools (like black) using `nox`. This session is currently restricted to Python 3+ code. ```bash nox -e formatters ``` -------------------------------- ### Run All Unit Tests with Docker Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Execute all unit tests for all supported Python versions using `ansible-test` within Docker. Verbose output is enabled with `-v`. ```bash ansible-test units --docker -v ``` -------------------------------- ### Create/Update Single DNS Record (community.dns) Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module for creating or updating a single DNS record. Ensure 'state' is specified. 'name' is a deprecated alias for 'prefix'. For TXT records, adjust the value or use 'txt_transformation'. ```yaml - name: Creating or updating a single DNS record with community.dns community.dns.hetzner_dns_record: zone_name: example.com # 'state' must always be specified: state: present # 'name' is a deprecated alias of 'prefix', so it can be # kept during a first migration step: name: localhost # 'type', 'value' and 'ttl' do not change: type: A value: 127.0.0.1 ttl: 60 # If type is TXT, you either have to adjust the value you pass, # or keep the following option: txt_transformation: api ``` -------------------------------- ### Run Hetzner Integration Tests with Specific Python Version Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Execute integration tests for Hetzner DNS modules using `ansible-test`. This command specifies Docker, Python 3.13, and allows unsupported modules. Ensure `integration_config.yml` is configured. ```bash ansible-test integration --docker default --python 3.13 --allow-unsupported hetzner ``` -------------------------------- ### Synchronize DNS records and prune others Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use `prune: true` with the `hetzner_dns_record_sets` module to ensure that only the specified records exist in the zone. Any records not listed will be deleted. The `ignore: true` option can be used to prevent modification of specific record types, such as NS records. ```yaml - name: Make sure that multiple records are present community.dns.hetzner_dns_record_sets: zone_name: example.com prune: true record_sets: - prefix: www type: A value: - 1.1.1.1 - 8.8.8.8 - prefix: www type: AAAA value: - '::1' - prefix: '' type: NS ignore: true ``` -------------------------------- ### Query HostTech DNS Zone Information by Name Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Use the community.dns.hosttech_dns_zone_info module to retrieve information about a DNS zone using its name. ```yaml - name: Query zone information by name community.dns.hosttech_dns_zone_info: zone_name: example.com register: result ``` -------------------------------- ### Query HostTech DNS Zone Information by ID Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Use the community.dns.hosttech_dns_zone_info module to retrieve information about a DNS zone using its integer ID. ```yaml - name: Query zone information by ID community.dns.hosttech_dns_zone_info: zone_id: 42 register: result ``` -------------------------------- ### Run HostTech Integration Tests with Specific Python Version Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Execute integration tests for HostTech DNS modules using `ansible-test`. This command specifies Docker, Python 3.13, and allows unsupported modules. Ensure `integration_config.yml` is configured. ```bash ansible-test integration --docker default --python 3.13 --allow-unsupported hosttech ``` -------------------------------- ### Run Unit Tests for Specific Python Version Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Run unit tests for a specific Python version using `ansible-test` with Docker. This is generally faster than running for all versions. ```bash ansible-test units --docker -v --python 3.13 ``` -------------------------------- ### Delete Multiple DNS Records: markuman.hetzner_dns vs community.dns Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Compares deleting multiple DNS records using the old markuman.hetzner_dns.record module and the new community.dns.hetzner_dns_record_set module. The new module operates on record sets and requires the 'prefix' parameter instead of 'name'. ```yaml - name: Deleting multiple DNS records with markuman.hetzner_dns markuman.hetzner_dns.record: zone_name: example.com state: absent name: localhost type: A ``` ```yaml - name: Deleting a single DNS record with community.dns community.dns.hetzner_dns_record_set: zone_name: example.com state: absent # 'name' is a deprecated alias of 'prefix', so it can be # kept during a first migration step: name: localhost # 'type' does not change: type: A ``` -------------------------------- ### Run Nox Code QA Linters Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Run code quality assurance linters, including flake8 and pylint, via `nox`. This session checks for code style and potential errors. ```bash nox -e codeqa ``` -------------------------------- ### Querying DNS Record Sets Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst The community.dns.hosttech_dns_record_set_info module allows querying DNS record sets. It supports querying single record sets, all record sets for a specific record name/prefix, or all record sets within a zone. Zone information can be provided by zone name or zone ID. ```APIDOC ## GET /api/dns/record_set_info ### Description Queries DNS record sets from the API. Can be used to query a single record set, all record sets for a record name/prefix, or all record sets for a zone. ### Method GET ### Endpoint /api/dns/record_set_info ### Parameters #### Query Parameters - **zone_name** (string) - Required - The name of the DNS zone. - **zone_id** (integer) - Required - The ID of the DNS zone. (Use either zone_name or zone_id) - **type** (string) - Optional - The type of DNS record to query (e.g., A, TXT, CNAME). - **what** (string) - Optional - Specifies the scope of the query. Possible values: 'single_record', 'all_types_for_record', 'all_records'. Defaults to 'single_record'. - **record** (string) - Optional - The fully qualified domain name of the record to query. - **prefix** (string) - Optional - The record prefix to query. Use '' for the zone itself. ### Request Example ```yaml - name: Query single A record community.dns.hosttech_dns_record_set_info: zone_name: example.com type: A record: www.example.com ``` - ```yaml - name: Query all record types for a prefix community.dns.hosttech_dns_record_set_info: zone_id: 42 what: all_types_for_record prefix: www ``` - ```yaml - name: Query all records for a zone community.dns.hosttech_dns_record_set_info: zone_name: example.com what: all_records ``` ### Response #### Success Response (200) - **set** (object) - Contains details of a single record set if 'what' is 'single_record'. - **type** (string) - The type of the record set. - **ttl** (integer) - The Time To Live for the record set. - **value** (array of strings) - The values associated with the record set. - **sets** (array of objects) - Contains details of multiple record sets if 'what' is 'all_types_for_record' or 'all_records'. Each object has 'type', 'ttl', 'record', and 'value' fields. #### Response Example ```json { "set": { "type": "A", "ttl": 300, "value": ["1.1.1.1", "1.0.0.1"] } } ``` - ```json { "sets": [ { "type": "A", "record": "www.example.com", "ttl": 300, "value": ["1.1.1.1"] }, { "type": "MX", "record": "example.com", "ttl": 3600, "value": ["10 mail.example.com"] } ] } ``` ``` -------------------------------- ### Query Hetzner DNS Zone Information by Name Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Retrieves information about a DNS zone using its name. The result is registered for later use. ```yaml - name: Query zone information by name community.dns.hetzner_dns_zone_info: zone_name: example.com register: result ``` -------------------------------- ### Set multiple DNS records at once Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use the `hetzner_dns_record_sets` module to set or update multiple DNS records simultaneously. This is useful for managing related records as a single operation. ```yaml - name: Make sure that multiple records are present community.dns.hetzner_dns_record_sets: zone_name: example.com record_sets: - prefix: www type: A value: - 1.1.1.1 - 8.8.8.8 - prefix: www type: AAAA value: - '::1' ``` -------------------------------- ### Run All Sanity Tests with Docker Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Execute all sanity tests using `ansible-test` within a Docker container. The `-v` flag provides verbose output. ```bash ansible-test sanity --docker -v ``` -------------------------------- ### Query All Record Sets for a Record Name Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this to query all record sets associated with a specific record name or prefix. This is useful for retrieving all types of records for a given hostname. ```yaml - name: Query all records for www.example.com community.dns.hetzner_dns_record_set_info: zone_name: example.com what: all_types_for_record # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www register: result - name: Show all records for www.example.com ansible.builtin.debug: msg: > {{ item.type }} record with TTL {{ item.ttl }} has values {{ item.value | join(', ') }} loop: result.sets ``` -------------------------------- ### Authenticate with HostTech WSDL API Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Provide username and password to hosttech_username and hosttech_password options for WSDL API access. ```yaml - community.dns.hosttech_dns_record: hosttech_username: '{{ username }}' hosttech_password: '{{ password }}' # ... ``` -------------------------------- ### Query Hetzner DNS Zone Information by ID Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Retrieves information about a DNS zone using its ID. The result is registered for later use. ```yaml - name: Query zone information by ID community.dns.hetzner_dns_zone_info: zone_id: aBcDeFgHiJlMnOpQrStUvW register: result ``` -------------------------------- ### Set or Update a DNS Record Set Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module to set or update an entire DNS record set. It allows specifying multiple values for a given record type and name. Ensure `state` is set to `present`. ```yaml - name: Make sure record is set to the given value community.dns.hetzner_dns_record_set: state: present zone_name: example.com type: A # IPv4 addresses # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www value: - 1.1.1.1 - 8.8.8.8 ``` -------------------------------- ### Query All Record Sets for a Zone Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this to retrieve all DNS record sets within a specified zone. This provides a comprehensive overview of all records in the zone. ```yaml - name: Query all records for a zone community.dns.hetzner_dns_record_set_info: zone_name: example.com what: all_records register: result - name: Show all records for the example.com zone ansible.builtin.debug: msg: > {{ item.type }} record for {{ item.record }} with TTL {{ item.ttl }} has values {{ item.value | join(', ') }} loop: result.sets ``` -------------------------------- ### Bulk Set/Update Multiple DNS Records Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst The `hosttech_dns_record_sets` module allows for setting or updating multiple DNS records simultaneously. Provide a list of record sets, each with its prefix, type, and values. ```yaml - name: Make sure that multiple records are present community.dns.hosttech_dns_record_sets: zone_name: example.com record_sets: - prefix: www type: A value: - 1.1.1.1 - 8.8.8.8 - prefix: www type: AAAA value: - '::1' ``` -------------------------------- ### Query Single DNS Record Set Info Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this to query a single DNS record set by name and type. Ensure the `zone_name` or `zone_id` is provided. You can specify either `record` name or `prefix`. ```yaml - name: Query single record community.dns.hetzner_dns_record_set_info: zone_name: example.com type: A # IPv4 addresses what: single_record # default value # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www register: result - name: Show IPv4 addresses if record exists ansible.builtin.debug: msg: > IPv4s are {{ result.set.value | join(', ') }}, TTL is {{ result.set.ttl }} when: result.set is truthy - name: Show that record is not set ansible.builtin.debug: msg: There is no A record for www.example.com when: result.set is falsy ``` -------------------------------- ### Run Specific Nox Sanity Tests Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Use `nox` to run specific testing sessions. The `-e lint` command runs all sanity tests and code formatting checks. ```bash nox -e lint ``` -------------------------------- ### Debug DNS Zone Information Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Use this snippet to display the zone ID and zone name returned by a DNS module. ```yaml - ansible.builtin.debug: msg: | The zone ID: {{ result.zone_id }} The zone name: {{ result.zone_name }} ``` -------------------------------- ### Run Nox Type Checking Source: https://github.com/ansible-collections/community.dns/blob/main/TESTING.md Perform type checking on Python 3+ code using mypy through `nox`. This helps ensure type consistency and catch potential type-related bugs. ```bash nox -e typing ``` -------------------------------- ### Creating, Updating, and Deleting DNS Records Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst The community.dns.hosttech_dns_record module allows for the creation, updating, and deletion of individual DNS records. Records are matched by their name and type. The TTL can be updated when setting or updating a record. ```APIDOC ## POST /api/dns/record ### Description Sets, updates, or removes individual DNS records. Records are matched by record name and type. TTL can be updated if specified. ### Method POST ### Endpoint /api/dns/record ### Parameters #### Path Parameters - **state** (string) - Required - The desired state of the record. Use 'present' to create/update, 'absent' to delete. #### Query Parameters - **zone_name** (string) - Required - The name of the DNS zone. - **zone_id** (integer) - Required - The ID of the DNS zone. (Use either zone_name or zone_id) - **type** (string) - Required - The type of DNS record (e.g., A, TXT, CNAME). - **record** (string) - Optional - The fully qualified domain name of the record. If not provided, it defaults to the zone name when 'prefix' is empty. - **prefix** (string) - Optional - The record prefix. Use '' for the zone itself. - **value** (string or array of strings) - Required for 'present' state - The value(s) for the DNS record. - **ttl** (integer) - Optional - The Time To Live for the record. Ignored when state is 'absent'. ### Request Example ```yaml - name: Add an A record community.dns.hosttech_dns_record: state: present zone_name: example.com type: A record: www.example.com value: 1.1.1.1 ttl: 300 ``` - ```yaml - name: Remove A records for www.example.com community.dns.hosttech_dns_record: state: absent zone_name: example.com type: A record: www.example.com ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the success of the operation. #### Response Example ```json { "message": "Record www.example.com of type A successfully updated." } ``` ``` -------------------------------- ### Set or Update DNS Record Set Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Use this module to ensure a DNS record set is present with specific values. It supports specifying either a record name or a prefix. Multiple values can be provided for a single record. ```yaml - name: Make sure record is set to the given value community.dns.hosttech_dns_record_set: state: present zone_name: example.com type: A # IPv4 addresses # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www value: - 1.1.1.1 - 8.8.8.8 ``` -------------------------------- ### Remove A records for a domain Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use `state: present` with an empty `value` list to remove all A records for a specific record name. This is an alternative to using `state: absent`. ```yaml - name: Remove A values for www.example.com community.dns.hetzner_dns_record_set: state: present zone_name: example.com type: A # IPv4 addresses record: www.example.com value: [] ``` -------------------------------- ### Add or Update a Single DNS Record Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module to set or update a single DNS record. It matches records by name and type, and updates the TTL if specified. Ensure `state` is set to `present`. ```yaml - name: Add an A record with value 1.1.1.1 for www.example.com, resp. make sure the TTL is 300 community.dns.hetzner_dns_record: state: present zone_name: example.com type: A # IPv4 addresses # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www value: 1.1.1.1 ttl: 300 ``` -------------------------------- ### Query All Record Sets for a Zone Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Retrieve all DNS record sets within a specified zone. This provides a comprehensive overview of all records configured for the zone. ```yaml - name: Query all records for a zone community.dns.hosttech_dns_record_set_info: zone_name: example.com what: all_records register: result ``` ```yaml - name: Show all records for the example.com zone ansible.builtin.debug: msg: > {{ item.type }} record for {{ item.record }} with TTL {{ item.ttl }} has values {{ item.value | join(', ') }} loop: result.sets ``` -------------------------------- ### Delete Single DNS Record (community.dns) Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hetzner_guide.rst Use this module for deleting a single DNS record. Ensure 'state' is absent. 'name' is a deprecated alias for 'prefix'. For TXT records, adjust the value or use 'txt_transformation'. ```yaml - name: Deleting a single DNS record with community.dns community.dns.hetzner_dns_record: zone_name: example.com state: absent # 'name' is a deprecated alias of 'prefix', so it can be # kept during a first migration step: name: localhost # 'type', 'value' and 'ttl' do not change: type: A value: 127.0.0.1 ttl: 60 # If type is TXT, you either have to adjust the value you pass, # or keep the following option: ``` -------------------------------- ### Query All Record Sets for a Record Name Source: https://github.com/ansible-collections/community.dns/blob/main/docs/docsite/rst/hosttech_guide.rst Query all DNS record sets associated with a specific record name or prefix within a zone. This is useful for retrieving all record types for a given hostname. ```yaml - name: Query all records for www.example.com community.dns.hosttech_dns_record_set_info: zone_name: example.com what: all_types_for_record # Either specify a record name: record: www.example.com # Or a record prefix ('' is the zone itself): prefix: www register: result ``` ```yaml - name: Show all records for www.example.com ansible.builtin.debug: msg: > {{ item.type }} record with TTL {{ item.ttl }} has values {{ item.value | join(', ') }} loop: result.sets ```