Reputation: 6320
I have an interactive build script, which contains sections like this:
echo "Is this correct?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit;;
esac
done
If I run the script on its own (./runscript.sh
), then I get correctly prompted.
But if I run the Bash script from inside Ansible, like this:
tasks:
- name: Run script
shell: "./runscript.sh {{ param1 }} {{ param2 }} {{ param3 }}"
args:
chdir: "../../path/to/script/"
run_once: true
delegate_to: localhost
Then this thing just runs through and I get no prompt, and I have no idea what's going on. Did it complete? How, with what settings? Does it just always implicitly assume a "YES"?
Upvotes: 0
Views: 723
Reputation: 1613
The shell
module execution is failing. If you print the rc
of the script execution it should be different from 0
. The reason is that the shell module
runs the command through a shell (/bin/sh), while select
is a Bash construct.
Upvotes: 2