--- - name: get facts become: true become_method: runas hosts: all gather_facts: false tasks: # - name: run the setup facts # ansible.builtin.setup: - name: try command ansible.windows.win_command: powershell.exe - args: stdin: Get-DnsClientServerAddress | select ServerAddresses -First 1 register: command_out ignore_errors: true - name: show dns configs debug: var: command_out.stdout