Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_dns_record: Unhandled exception while executing module: Failed to remove resource record #500

Open
semlohnayr opened this issue Mar 15, 2023 · 2 comments

Comments

@semlohnayr
Copy link

SUMMARY

Trying to delete records (state: absent) using community.windows.win_dns_record results in a task failure but the actual record gets deleted. If I rerun the task to delete the record, ok is returned. I do not have any issues adding dns records.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.windows.win_dns_record version 1.12.0

ANSIBLE VERSION
2.13.5
COLLECTION VERSION
community.windows 1.12.0
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

@rhochmayr
Copy link

rhochmayr commented May 10, 2023

Hi There

We are seeing the same issue when running following step:

name: "{{ server_name }}"  
type: "A"  
state: absent  
zone: "{{ dns_domain }}"  
computer_name: "{{ dns_domain }}"  

Here is our cleaned-up output:

{
  "exception": "Failed to remove resource record <servername> from zone <zone> on server <computername>\nAt line:86 char:23\r\n+ ...   $record | Remove-DnsServerResourceRecord -ZoneName $zone -Force -Wh ...\r\n+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n    + CategoryInfo          : NotSpecified: (<servername>:root/Microsoft/...rResourceRecord) [Remove-DnsServerResourceRecord], CimException\n    + FullyQualifiedErrorId : WIN32 9715,Remove-DnsServerResourceRecord\r\n\r\nScriptStackTrace:\r\n\r\n\r\nMicrosoft.Management.Infrastructure.CimException: Failed to remove resource record <servername> from zone <zone> on server <computername>\r\n   at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)",
  "msg": "Unhandled exception while executing module: Failed to remove resource record <servername> from zone <zone> on <computername>",
  "_ansible_no_log": false,
  "changed": false,
  "_ansible_delegated_vars": {
    "ansible_host": "<ansible-host>",
    "ansible_port": 5986,
    "ansible_user": "<username>",
    "ansible_connection": "<connection>"
  }
}

Oddly enough WIN32 9715 seems to reference an error when creating a PTR record. Not sure how this is related when Removing an A record.
https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--9000-11999-

So far we have seen the issue come up when there is no existing reverse zone for the address of the A record that should be deleted.

However, we tried to reproduce the issue in another environment, and there a missing reverse zone didn't cause a problem. It's been a very intermittend issue so far.

Thanks
Rob

@rhochmayr
Copy link

Hi again

Just a quick update, in our case it turned out to be a permission issue on some reverse zones wich caused the error to come up when deleting the A record, wich in turn automatically also tries to remove the respective reverse record.

So this issue, at least in our case, was not related to the ansbible module as such since we were able to reproduce it with native tools als well.

Thanks
Robert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants