diff --git a/test-playbooks/win_dns_ps.yml b/test-playbooks/win_dns_ps.yml index e5c2f17..9249aae 100644 --- a/test-playbooks/win_dns_ps.yml +++ b/test-playbooks/win_dns_ps.yml @@ -1,34 +1,20 @@ --- -- name: Check and Configure DNS on Windows - hosts: windows_all +- name: Test Windows connection + hosts: all gather_facts: no vars: ansible_connection: winrm - ansible_winrm_server_cert_validation: ignore - ansible_shell_type: powershell - ansible_remote_tmp: C:\Windows\Temp + ansible_port: 5985 + ansible_winrm_scheme: http # явно указываем HTTP tasks: - - name: Get all active network adapters - ansible.windows.win_shell: | - Get-NetAdapter | Where-Object { $_.Status -eq "Up" } | Select-Object Name, InterfaceIndex, Status - register: adapters + - name: Test WinRM ping + win_ping: - - name: Display active adapters - ansible.builtin.debug: - var: adapters.stdout_lines - - - name: Check DNS for each active adapter - ansible.windows.win_shell: | - $adapters = Get-NetAdapter | Where-Object { $_.Status -eq "Up" } - foreach ($adapter in $adapters) { - Write-Output "=== Adapter: $($adapter.Name) ===" - Get-DnsClientServerAddress -InterfaceIndex $adapter.InterfaceIndex - Write-Output "" - } - register: dns_info + - name: Get hostname + win_command: hostname + register: result - - name: Show DNS information - ansible.builtin.debug: - var: dns_info.stdout_lines \ No newline at end of file + - debug: + var: result.stdout \ No newline at end of file