Open ySp-chld opened 6 months ago
We are experiencing similar behaviour when trying to add a CNAME to a DNS forward lookup table using community.windows.win_dns_record
. Occasionally, the CNAME will simply not be present when examining the DNS configuration in the DNS Manager dialog of the Server Manager tool. No error indication of any kind.
Ansible [core 2.16.7] python version 3.10.12 jinja version 3.1.4 libyaml = true
community.windows 2.2.0
Same here, we tried adding type A records. The module is showing state changed with no errors, and if we replay it, it's green with OK state. However no DNS entry was created in our DNS server.
Here is how we use the module :
- name: Create a DNS record
community.windows.win_dns_record:
name: "mytest.mydomain.com"
computer_name: "{{ my_dns_server_private_ip }}"
type: "A"
value: "{{ mytest_private_ip }} "
zone: "mydomain.com"
delegate_to: "{{ my_windows_server }}
vars:
ansible_user: {{ my_user }}
ansible_password: "{{ my_password }}"
ansible_connection: winrm
ansible_port: 5986
ansible_winrm_transport: credssp
ansible_winrm_server_cert_validation: ignore
ansible [core 2.15.8] python version = 3.9.19 jinja version = 3.1.4 libyaml = True community.windows 2.2.0
We found what our issue was. It turns out that when creating a type A record, you MUST remove the domain from the "name" field (similarly to CNAME records), contrary to what the example in the official documentation says :
The official doc example :
- name: Create database server record
community.windows.win_dns_record:
name: "cgyl1404p.amer.example.com" ---> Does not work
type: "A"
value: "10.1.1.1"
zone: "amer.example.com"
What you should do instead :
- name: Create database server record
community.windows.win_dns_record:
name: "cgyl1404p" ---> Works
type: "A"
value: "10.1.1.1"
zone: "amer.example.com"
Leaving this here in case it helps someone.
SUMMARY
Trying to add record to DNS using
win_dns_record
:WinRM Connection works, I can run thos command from a powershell session myself. the status I get is
Changed
.However being adding a record or editing a record do not do anything.
ISSUE TYPE
COMPONENT NAME
win_dns_record
ANSIBLE VERSION
COLLECTION VERSION
EXPECTED RESULTS
DNS record is updated or added.
ACTUAL RESULTS
Everything seems OK but nothing happen on the DNS server.
No modification, no new record either.
Truncated part convert to that output (using
base64 -d
twice gices that: