Hi All,
I need help in executing batch file which has some prompts.
Am using following lines of script
name: run an executable with custom working dir
win_command: pisrvstop.bat /argument1 “/argument 2 with space”
args:
chdir: F:\Program Files\PI\adm
async: 120
poll: 5
it works fine but it will not answer for the prompts. How do i set the answers for prompt?
Ansible modules are designed to be run in a non-interactive fashion, you won’t receive the prompt on the controller as that’s just not how Ansible works. You also won’t be able to use expect for Windows as that is a Python module. Your best bet is to the use stdin option for win_command to send data over the stdin pipe. This is a very basic mechanism but if all you need to do is type ‘y’ then send y over stdin.
Thanks for the detailed description. Actually am working on stopping services which has dependencies just like service A dependent on Service B, am having issue in this scenario. Can you please give some info on stopping dependencies as well?