I have a simple powershell script(debug.ps1) which takes user input from read-host and displays it
$var = read-host "Enter text"
write-host $var
I want to run this from ansible but when I try through stdin, the job executes indefinitely. How do I pass input to read-host from ansible?
tasks:
- name: Executing script
win_shell: .\debug.ps1
register: output
args:
chdir: C:\Scripts\
stdin: 'hello'
- debug: var=output.stdout_lines
expectmodule. Note the requirements on the documentation. From a very quick search, it looks like pexpect is available for windows.