diff --git a/changelogs/fragments/5972-cloudflare-dns-srv-record.yml b/changelogs/fragments/5972-cloudflare-dns-srv-record.yml new file mode 100644 index 0000000000..a331b49d23 --- /dev/null +++ b/changelogs/fragments/5972-cloudflare-dns-srv-record.yml @@ -0,0 +1,3 @@ +bugfixes: + - "cloudflare_dns - fixed the possiblity of setting a root-level SRV DNS record (https://github.com/ansible-collections/community.general/pull/5972)." + - "cloudflare_dns - fixed the idempotency for SRV DNS records (https://github.com/ansible-collections/community.general/pull/5972)." diff --git a/plugins/modules/cloudflare_dns.py b/plugins/modules/cloudflare_dns.py index a0fa8a38b2..8f45fcef3b 100644 --- a/plugins/modules/cloudflare_dns.py +++ b/plugins/modules/cloudflare_dns.py @@ -694,10 +694,11 @@ class CloudflareAPI(object): "port": params['port'], "weight": params['weight'], "priority": params['priority'], - "name": params['record'][:-len('.' + params['zone'])], + "name": params['record'], "proto": params['proto'], "service": params['service'] } + new_record = {"type": params['type'], "ttl": params['ttl'], 'data': srv_data} search_value = str(params['weight']) + '\t' + str(params['port']) + '\t' + params['value'] search_record = params['service'] + '.' + params['proto'] + '.' + params['record']