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: state changed but nothing is done when adding record #564

Open
nuuantoine opened this issue May 6, 2024 · 0 comments
Open

Comments

@nuuantoine
Copy link

SUMMARY

Trying to add record to DNS using win_dns_record :

  tasks:
   - name: Create DNS record
     community.windows.win_dns_record:
       name: "thisisatestrecord"
       zone: "domain.lan"
       type: "A"
       value: "10.4.95.70"
       computer_name: "DNS-SERVER.domain.lan"
     delegate_to: bastion-machine

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
  • Bug Report
COMPONENT NAME

win_dns_record

ANSIBLE VERSION
ansible [core 2.15.8]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.18 (main, Jan  4 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
amazon.aws              7.2.0
ansible.netcommon       6.0.0
ansible.posix           1.5.4
ansible.utils           3.0.0
ansible.windows         2.2.0
awx.awx                 23.6.0
azure.azcollection      2.1.1
chocolatey.chocolatey   1.5.1
cloud.common            3.0.0
community.general       8.2.0
community.mongodb       1.4.2
community.vmware        4.0.1
community.windows       2.1.0
datadog.dd              5.0.1
f5networks.f5_modules   1.27.1
google.cloud            1.3.0
kubernetes.core         3.0.0
openstack.cloud         2.2.0
ovirt.ovirt             3.2.0
redhatinsights.insights 1.2.2
theforeman.foreman      4.0.0
vmware.vmware_rest      3.0.0
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.

Using module file /usr/share/ansible/collections/ansible_collections/community/windows/plugins/modules/win_dns_record.ps1
Pipelining is enabled.
<bastion-machine.DOMAIN.LAN> ESTABLISH WINRM CONNECTION FOR USER: [email protected] on PORT 5985 TO bastion-machine.DOMAIN.LAN
creating Kerberos CC at /tmp/tmpl0w0iyc3
calling kinit with pexpect for principal [email protected]
kinit succeeded for principal [email protected]
<bastion-machine.DOMAIN.LAN> WINRM CONNECT: transport=kerberos endpoint=http://bastion-machine.DOMAIN.LAN:5985/wsman
<bastion-machine.DOMAIN.LAN> WINRM OPEN SHELL: 06AF7DF0-4E52-4037-8726-A8B0FBDBEB3B
EXEC (via pipeline wrapper)
<bastion-machine.DOMAIN.LAN> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-EncodedCommand', '[TRUNCATED]']
<bastion-machine.DOMAIN.LAN> WINRM RESULT '<Response code 0, out "{"changed":true,"inv", err "#< CLIXML\\r\\n<Objs Ver">'
<bastion-machine.DOMAIN.LAN> WINRM CLOSE SHELL: 06AF7DF0-4E52-4037-8726-A8B0FBDBEB3B

<bastion-machine.domain.lan> WINRM CLOSE SHELL: 06AF7DF0-4E52-4037-8726-A8B0FBDBEB3B
changed: [machine -> bastion-machine.domain.lan] => {
    "changed": true,
    "debug_splat_args": {
        "A": true,
        "IPv4Address": "10.4.95.70"
    },
    "invocation": {
        "module_args": {
            "aging": false,
            "computer_name": "DNS-SERVER.domain.lan",
            "name": "thisisatestrecord",
            "port": null,
            "priority": null,
            "state": "present",
            "ttl": 3600,
            "type": "A",
            "value": [
                "10.4.95.70"
            ],
            "weight": null,
            "zone": "domain.lan",
            "zone_scope": null
        }
    }
}

Truncated part convert to that output (using base64 -d twice gices that:

&chcp.com 65001 > $null
if ($PSVersionTable.PSVersion -lt [Version]"3.0") {
'{"failed":true,"msg":"Ansible requires PowerShell v3.0 or newer"}'
exit 1
}
$exec_wrapper_str = $input | Out-String
$split_parts = $exec_wrapper_str.Split(@("`0`0`0`0"), 2, [StringSplitOptions]::RemoveEmptyEntries)
If (-not $split_parts.Length -eq 2) { throw "invalid payload" }
Set-Variable -Name json_raw -Value $split_parts[1]
$exec_wrapper = [ScriptBlock]::Create($splbase64: invalid input
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

1 participant