- name: List directory contents hosts: windows gather_facts: false tasks: - name: List files and directories ansible.windows.win_shell: | Get-ChildItem C:\apps register: dir_listing - name: Display directory contents ansible.builtin.debug: var: dir_listing.stdout_lines