--- - name: win_file module demo hosts: all vars: ansible_shell_type: powershell shell_type: powershell tasks: - name: Creating an empty file win_shell: | $value = Test-Path -Path C:\windows\temp if ($value) { New-Item C:\windows\temp\test.txt -ItemType File }