Обновить test-playbooks/win_dns_ps.yml
This commit is contained in:
@@ -1,34 +1,20 @@
|
|||||||
---
|
---
|
||||||
- name: Check and Configure DNS on Windows
|
- name: Test Windows connection
|
||||||
hosts: windows_all
|
hosts: all
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
ansible_connection: winrm
|
ansible_connection: winrm
|
||||||
ansible_winrm_server_cert_validation: ignore
|
ansible_port: 5985
|
||||||
ansible_shell_type: powershell
|
ansible_winrm_scheme: http # явно указываем HTTP
|
||||||
ansible_remote_tmp: C:\Windows\Temp
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get all active network adapters
|
- name: Test WinRM ping
|
||||||
ansible.windows.win_shell: |
|
win_ping:
|
||||||
Get-NetAdapter | Where-Object { $_.Status -eq "Up" } | Select-Object Name, InterfaceIndex, Status
|
|
||||||
register: adapters
|
|
||||||
|
|
||||||
- name: Display active adapters
|
- name: Get hostname
|
||||||
ansible.builtin.debug:
|
win_command: hostname
|
||||||
var: adapters.stdout_lines
|
register: result
|
||||||
|
|
||||||
- name: Check DNS for each active adapter
|
- debug:
|
||||||
ansible.windows.win_shell: |
|
var: result.stdout
|
||||||
$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: Show DNS information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
var: dns_info.stdout_lines
|
|
||||||
Reference in New Issue
Block a user