Howdy,
I am also seeing this issue.
chris:~/git/ansible$ ansible -m community.windows.win_dns_record -a "type=CNAME computer_name='dc1.example.local' name=myapp zone='
internal.example.co.uk' ttl=60 value='docker1.example.local'" -i inventory/test.yml admgmthost -vvv
ansible [core 2.11.5]
config file = /home/chris/git/ansible/ansible.cfg
configured module search path = ['/home/chris/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/chris/git/.venv/lib/python3.8/site-packages/ansible
ansible collection location = /home/chris/git/ansible/installed_collections
executable location = /home/chris/git/.venv/bin/ansible
python version = 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0]
jinja version = 3.0.1
libyaml = True
Using /home/chris/git/ansible/ansible.cfg as config file
host_list declined parsing /home/chris/git/ansible/inventory/test.yml as it did not pass its verify_file() method
script declined parsing /home/chris/git/ansible/inventory/test.yml as it did not pass its verify_file() method
Parsed /home/chris/git/ansible/inventory/test.yml inventory source with yaml plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
Using module file /home/chris/git/.venv/lib/python3.8/site-packages/ansible_collections/community/windows/plugins/modules/win_dns_record.ps1
Pipelining is enabled.
<admgmthost.example.local> ESTABLISH WINRM CONNECTION FOR USER: example\service.ansible on PORT 5985 TO admgmthost.example.local
EXEC (via pipeline wrapper)
The full traceback is:
Failed to get the zone information for
internal.example.co.uk on server admgmthost.
At line:73 char:12
+ $records = Get-DnsServerResourceRecord -ZoneName $zone -Name $name -R ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (internal.example.co.uk:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException
+ FullyQualifiedErrorId : WIN32 1722,Get-DnsServerResourceRecord
ScriptStackTrace:
at Get-DnsServerResourceRecord<End>, <No file>: line 4075
at <ScriptBlock>, <No file>: line 73
Microsoft.Management.Infrastructure.CimException: Failed to get the zone information for
internal.example.co.uk on server admgmthost.
at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)
admgmthost | FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: Failed to get the zone information for
internal.example.co.uk on server admgmthost."
}
I have verified that the ps1 file looks correct located at: /home/chris/git/.venv/lib/python3.8/site-packages/ansible_collections/community/windows/plugins/modules/win_dns_record.ps1
Installed 1.7.0 of the ansible.windows collection.
Re-created the Get-DNSServerResourceRecord command used here and ran on a windows machine via winrm to the same admgmthost server with no issue. Also ran find on the host machine logged in as the service.ansible user. Interestingly, if I omit the -ComputerName switch in the powershell replicas I get the same response. However, it appears as though the variables are being set correctly in the win_dns_record.ps1 file... unless I missed something :)
Any thoughts?
Cheers
Chris