I have tried to create a CNAME record in a subdomain. Instead of adding the record in the existing subdomain, the module recreate an arborescence of subdomain in which the record is created.
The alias I want to create : helloworld.test.example.com
Use
- name: Create the server alias
community.windows.win_dns_record:
name: "helloworld.test"
type: "CNAME"
value: "myserver.example.com"
zone: "example.com"
EXPECTED RESULTS
The expected result is the creation of a CNAME record named "helloworld" in the subdomain "test" of the domain "example.com". This record should point to the host myserver.example.com.
ACTUAL RESULTS
In the domain "example.com", I get a new subdomain named "com", under which I get a new subdomain named "example", under which I get a new subdomain named "test", under which I find the record "helloworld".
PROPOSED SOLUTION
After taking a look at the module code, I think the behaviour could be fixed by adding a specific case for CNAME in this try/catch.
I have found there is a powershell module dedicated to CNAME record.
The following powershell command is able to create te required CNAME : Add-DnsServerResourceRecordCName -Name "helloworld.test" -HostNameAlias "myserver.example.com" -ZoneName "example.com"
I think the extra arguments are also compatible with this powershell module, but I am not sure.
Change to documentation :
When the "type" parameter has "CNAME" has a value, the "name" parameter could include subdomain(s) where the record should be created, according to the domain defined by the "zone" parameter".
When the "type" parameter has "CNAME" has a value, the "value" parameter contains the target host.
SUMMARY
I have tried to create a CNAME record in a subdomain. Instead of adding the record in the existing subdomain, the module recreate an arborescence of subdomain in which the record is created.
ISSUE TYPE
COMPONENT NAME
win_dns_record
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Based on the following example :
Use
EXPECTED RESULTS
The expected result is the creation of a CNAME record named "helloworld" in the subdomain "test" of the domain "example.com". This record should point to the host myserver.example.com.
ACTUAL RESULTS
In the domain "example.com", I get a new subdomain named "com", under which I get a new subdomain named "example", under which I get a new subdomain named "test", under which I find the record "helloworld".
PROPOSED SOLUTION
After taking a look at the module code, I think the behaviour could be fixed by adding a specific case for CNAME in this try/catch. I have found there is a powershell module dedicated to CNAME record.
The following powershell command is able to create te required CNAME :
Add-DnsServerResourceRecordCName -Name "helloworld.test" -HostNameAlias "myserver.example.com" -ZoneName "example.com"
So we could add something like :
I think the extra arguments are also compatible with this powershell module, but I am not sure.
Change to documentation :