Closed nklamann closed 1 year ago
Maybe it makes sense to return the TTL too ? And/ or the MX priority. This gets crazy fast ....
The functionality i look for is in community.dns.hetzner_dns_record_set_info
- name: Query all records for www.example.com
community.dns.hetzner_dns_record_set_info:
zone_name: klamann-service.de
what: all_records
register: records
- name: "show records"
ansible.builtin.debug:
var: records
The inventory plugin is for composing Ansible inventories, for example if you want to find the servers you want to run something on by looking in a DNS zone. As you correctly noticed, there are other modules that retrieve the list of (all) DNS records, if you are simply interested in the raw records.
SUMMARY
community.dns.hetzner_dns_records inventory plugin return data does not show all relevant data
ISSUE TYPE
COMPONENT NAME
community.dns.hetzner_dns_records inventory plugin
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
WSL2 debian 11 under Windows 10
STEPS TO REPRODUCE
A DNS entry at hetrzner consists of the 'fields' TYPE, NAME and VALUE.
When I want to get information about a zone with the inventory plugin
community.dns.hetzner_dns_records
I get a list of jsons structures keyed by the concatenation ofVALUE
andzone_name
, each contains a fieldansible_host
, which contains theVALUE
in the record and a fieldmail_relay
,which is a host_var in my local ansible configuration and has nothing to do with hetzner .This has 2 important problems:
VALUE
andzone_name
is not unique (for exampe if A and AAAA records are reportedThis is difficult to work with when only one type of DNS data is required , but the module allows a list of Tpes and then it is impossible to say which result is which TYPE.
But the not uniqueness of the key is the real problem here and makes the ouput wrong, existing records are silently ignored.
Command was
EXPECTED RESULTS
a list of entries, each containing TYPE, NAME, VALUE (and zone_name for good measure, the the inventory could contain several zoens in one go) containing this information ( ('klamann-service.de','@','A','an IP') ,('klamann-service.de','cloud2','A','an IP') ,('klamann-service.de','mail','A','an IP') ,('klamann-service.de','@','AAAA','an IP') ,('klamann-service.de','cloud2','AAAA','an IP') ,('klamann-service.de','mail','AAAA','an IP') ,('klamann-service.de','fossil','CNAME','cloud2') ,('klamann-service.de','webmail','CNAME','mail')
)
or a list of dictioanaries
or a dictionary as now containing a list of dictionaries.
ACTUAL RESULTS
Only 3 records delivered because wrong key , type info not available, spurious variable (mail_ralay) from local configuration .